2 Replies - 21738 Views - Last Post: 07 May 2011 - 10:26 AM Rate Topic: -----

#1 sm82   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 07-May 11

LINK : error LNK2001: unresolved external symbol _mainCRTStartup

Posted 07 May 2011 - 08:51 AM

Hi, I'm using visual studio 2010, but couldn't run any code; I'm getting this build error:
"LINK : error LNK2001: unresolved external symbol _mainCRTStartup"
for example, even for this simple code,
using namespace std;

int main()
	int i;
	return 0;

I guess it's a linking problem but don't know how to do it. Please let me know the reason and solution. Thank you.

Is This A Good Question/Topic? 0
  • +

Replies To: LINK : error LNK2001: unresolved external symbol _mainCRTStartup

#2 r.stiltskin   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2034
  • View blog
  • Posts: 5,436
  • Joined: 27-December 05

Re: LINK : error LNK2001: unresolved external symbol _mainCRTStartup

Posted 07 May 2011 - 08:57 AM

It seems that you don't have the project configured correctly for a console application. Create a new project following these steps:

When you start the new project wizard, click Win32 Console Application, enter a project name, click OK, then on the next screen click "Application Settings", then "Console application" and "Empty project".

That gives you a completely empty project, so click on Project/Add New Item/C++ File, enter a filename for your main file, and that will open an empty .cpp file.

Now type (or paste in) your code.
Was This Post Helpful? 2
  • +
  • -

#3 RevTorA   User is offline

  • D.I.C Regular
  • member icon

Reputation: 78
  • View blog
  • Posts: 255
  • Joined: 22-April 11

Re: LINK : error LNK2001: unresolved external symbol _mainCRTStartup

Posted 07 May 2011 - 10:26 AM

Just to add to this, I actually had this problem just yesterday, and it was because when I initially put in "main.cpp" as a filename, I did "main.cpp\", and as such, VC++ decided it wasn't part of the program. I just had to go to the file's properties and tell VC++ that it was indeed to be included when building the project, and then it worked fine.

Normally, an error like this would be because you told VC++ that this was a windows gui program, and as such the load was looking for "WinMain" instead of "main", but since it's not finding "mainCRT", I think that you probably just did what I did.

Probably easier to do what stiltskin said, but just thought I'd mention it hehe.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1