开发者

Problem while Debugging a C++ project using Visual Studio 2010

开发者 https://www.devze.com 2023-01-29 07:55 出处:网络
I\'m having two errors everytime I try to debug a simple project in Visual Studio 2010. Error1error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartupC:\\Users\\Fight

I'm having two errors everytime I try to debug a simple project in Visual Studio 2010.

Error   1   error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup   C:\Users\Fighter\Documents\C++\Point\Point\MSVCRTD.lib(crtexe.obj)  Point

Error   2   error LNK1120: 1 unresolved externals   C:\Users\Fighter\Documents\C++\Point\Debug\Point.exe    1   1   Point

this is a simple code I'm using to try my program in VS :

class Point

{
private:
int x;
int y;

};

The problem is that this thing w开发者_StackOverflow中文版orks great in Code::Blocks but whith VS it gives me those errors.

What's the problem here.

Thanks


Your program needs a main() function to be valid.

int main(int argc, char* argv[]) 
{
    Point p;
    return 0;
} 


The compiler says to you that he wants you to define an entry point to your application. (a.k.a a function main.)


You need to define a function named main() or main(int argc, char **argv).


Every C++ program must have a function called main(). It can take one of two forms:

  1. int main()
  2. int main(int argc, char* argv[])

Implement one of these (probably the first), and recompile.

0

精彩评论

暂无评论...
验证码 换一张
取 消