unresolved externals error. What does this mean?

Hey guys I'm trying to get back in the swing of programming and I'm getting a very stupid error. It's not a syntax error so I don't know what the heck it is or means.

1>------ Build started: Project: tester, Configuration: Debug Win32 ------
1>LINK : error LNK2001: unresolved external symbol _mainCRTStartup
1>c:\users\my name\documents\visual studio 2010\Projects\tester\Debug\tester.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I tried to do some googling but I don't understand what the solutions are asking to do such as this one. http://social.msdn.microsoft.com/Forums/en/vclanguage/thread/14e85604-6929-4707-a22e-8cdf596926a6
The answer that Bao Baboon gave probably is the most correct i think. Just because the file is open in the editor doesn't mean that its part of the program. You need to tell MSVC that it needs to be compiled as part of your program.

Press CTRL+SHIFT+A and select the file that has the main in your code. If that doesn't fix the problem, then you'll need to redefine your main to be WinMain, or set the subsystem options to console.

It would be good if you posted some code too.
check your header.
and your function prototype.

you can post your current coding to here
always face this problem for ampersand sign.

mean &
@pogrady
CTRL+SHIFT+A didn't do the trick and I don't know what you mean by what you mean by this
then you'll need to redefine your main to be WinMain, or set the subsystem options to console.

I use VC++ 2010 and I set the project to be Win32 Console Application (it's only type I've ever used) The code a basic program I copied from the book I was trying to see if it mattered when I altered something in the code (different from the book) but this error occurred when I was just trying to compile the way the program was written in the book. The code is as follows
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 #include <iostream>
using namespace std;
void changeme(int)
int main()
{
	int munber = 12;
	count << "the number is " << number << endl;
	changeme(number);
	cout << "now back in main, the value of number is " << endl;
	return 0;
}

void changeme(int myvalue)
{
	myvalue = 0;
	cout << "now the value is " << myvalue << endl;
}


I didn't paste it before because I was embarrassed at how basic of a program it is.

@Felicia
I copied the program exactly the way it's written in the book (with the exception of capitalizing the names of the parameters)
Last edited on
It looks like you created CLR console application instead of Win32 console application in MS VS IDE.
Last edited on
try this
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
using namespace std;
void changeme(int);
int main()
{
	int number = 12;
	cout << "the number is " << number << endl;
	changeme(number);
	cout << "now back in main, the value of number is " << endl;
	return 0;
}

void changeme(int myvalue)
{
	myvalue = 0;
	cout << "now the value is " << myvalue << endl;
}


well this is weird I fixed it by recreating the project and opening the new file but I swear the only thing I did different was the way I open the .cpp file. (I right-clicked the source code folder instead of clicking the project drop down menu) must've been a fluke in the IDE.
Last edited on
dam I now I'm realizing I can't run the program the way I used so I don't know how to run it. I used to be able to go to debug > start without debugging but start without debugging isn't an option.
found a site that taught me how to manually add it to the debug drop down menu. Can't believe I had to do that though. It's always been there before.
Topic archived. No new replies allowed.