954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Error: LNK2001 and LNK1120 in visual studio 2010

At debugging the code, the program gives 2 errors

Error 1 error LNK2001: unresolved external symbol _mainCRTStartup

Error 2 error LNK1120: 1 unresolved externals

mohamed_nasr
Newbie Poster
7 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 

Did you code a main() function?

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

yes

int main()
mohamed_nasr
Newbie Poster
7 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 

Is this the first console program you have written since installing that compiler? Maybe you have a configuration problem.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

it is the first time to use the program on windows 7

mohamed_nasr
Newbie Poster
7 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 

Please read this thread and see if it helps you.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

it doesn't work

mohamed_nasr
Newbie Poster
7 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 
int main()
{
return 0;
}


This compiles fine on my system; it must be your setup. Did you definitely make it clear that you wanted to create a console programme and not any kind of windowed programme?

Moschops
Practically a Master Poster
620 posts since Sep 2008
Reputation Points: 258
Solved Threads: 117
 

console program

mohamed_nasr
Newbie Poster
7 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 

Attached is a HelloWorld program I created. Unzip it on your computer then load the solution and try to compile/link it.

Attachments HelloWorld.zip (7.3KB)
Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

it gave the same error

mohamed_nasr
Newbie Poster
7 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 

i found a solution
the problem was that the cpp file is generated in "source files" folder

thank you

mohamed_nasr
Newbie Poster
7 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: