So I recently had to reinstall my laptop. It originally came with Windows 8 but I decided I wanted Windows 7. After installing Visual Studio C++ 2010 Express and other stuff I needed I got back to programming using my textbook. However, I keep getting an unresolved external error. I tested it to see if it was that specific program. I wrote a easy and short one and it still gave me the same error. All my other programs work just not any new ones. Do I need addition software to be able to use VS again?
In order for us to provide solutions and tips we require additional details and specifics.
I think the problems lays in the linking (obvious), to link it via code add this next to declared header files like this:
#pragma comment(lib,"lib")
Try not to add duplicate header files in your project for example:
in Windows.h header file, the Winsock.h\Winsock2.h header files are declared in Windows.h and if you declare the Winsock header files again it can cause unwanted issues. Therefore check if other of the header files are already declared before declaring them.
Next I want to build upon what Zhuge said, Old Projects may even have different\custom settings therefore the new Visual Studio (VS) projects may not be able to correctly analyze the setting or some of the custom setting may have disabled or changed few settings which caused errors.
Well this is what I was using as a test. I used this because it was short and easy. I was using the same version of VS before thats why I thought I might be missing something.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include <iostream>
usingnamespace std;
int main()
{
int num1;
cout << "Enter a numbers and we will show them back to you" << endl;
cin >> num1;
cout << "Showing the number back to you" << endl;
cout << num1 << endl;
cin.get();
return 0;
}
VS tells me that there are build errors and the error log says "Error 1 error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup"
I figured it out. I tried making another project and I guess I clicked on Win32 Project not Console Application -__-.
Sorry guys. Thanks for helping me out.