Sign in with
Sign up | Sign in
Your question

Unresolvable C++ Compiling Error

Last response: in Applications
September 9, 2010 6:21:39 AM

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!
a b L Programming
September 9, 2010 6:38:59 AM

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.
September 9, 2010 3:36:43 PM

Ahhhh! There it is!

Thanks a million!