Unresolvable C++ Compiling Error

newbuu2

Distinguished
Mar 1, 2009
2
0
18,510
Hello all!

I've just downloaded Microsoft Visual C++ 2010 Express and have been trying to compile my code, however, every time I attempt to debug it I always get this error:

1>------ Build started: Project: grades04, Configuration: Debug Win32 ------
1>LINK : error LNK2001: unresolved external symbol _mainCRTStartup
1>C:\Users\Cory\Documents\Visual Studio 2010\Projects\grades04\Debug\grades04.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I've scoured the net and have no luck with resolving my issue... Apparently it's a linker problem, but all the responses to the problem seem to be about templates, which I am not using.

For instance, I open of Visual C++ then File > New Project > Win32 Console Application. At this point I tell it to create an empty project. After it's created I go to File > New File > C++ File. Then, in this C++ file, I type my code. No matter what code I type in, even the simple "Hello, world!" code, I get the above error.

I have a hunch that somehow the C++ file I am adding isn't being linked to the project I created, but, have found no way to remedy the problem

Thanks for your help!
 

Ijack

Distinguished
As you say, you are not adding the source file to the project. You should right-click "source" in the Solution Explorer and add the file from there rather than from the "File" menu. (If you do the latter then you have to manually add the file to the project.)

It's normally easier not to tick the "empty project" option but to let the wizard create the skeleton for you.