. Advertisement .
..3..
. Advertisement .
..4..
I am working with cpp and getting the error message:
MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol WinMain@16 referenced in function __tmainCRTStartup
Here is the detail of the code that I ran
#include <iostream>
using namespace std;
int main()
{
const double A = 15.0,
B = 12.0,
C = 9.0;
double aTotal, bTotal, cTotal, total;
int numSold;
cout << "Enter The Number of Class A Tickets Sold: ";
cin >> numSold;
aTotal = numSold * A;
cout << "Enter The Number of Class B Tickets Sold: ";
cin >> numSold;
bTotal = numSold * B;
cout << "Enter The Number of Class C Tickets Sold: ";
cin >> numSold;
cTotal = numSold * C;
total = aTotal + bTotal + cTotal;
cout << "Income Generated" << endl;
cout << "From Class A Seats [codesample]quot; << aTotal << endl;
cout << "From Class B Seats [codesample]quot; << bTotal << endl;
cout << "From Class C Seats [codesample]quot; << cTotal << endl;
cout << "-----------------------" << endl;
cout << "Total Income: " << total << endl;
return 0;
}
I need an explanation for the problems I’ve encountered. How to fix fatal error lnk1120: 1 unresolved externals?
The cause: You selected the incorrect application type while starting the project. You chose incorrectly a windows application when asked whether your project was a console application, windows application, DLL, or static library (wrong choice).
Solution:
To fix the lnk1120: 1 unresolved externals error, you should do this:
Go back and start over by selecting File > New > Project > Win32 Console Application > naming your project and then selecting Application Settings.
Make sure Console Application is chosen for the application type (crucial step).
The main is known as WinMain for Windows applications, DllMain for DLLs, Main(cli::array) for.NET applications, and there is no main for static libraries. Main is only referred to as main in console apps.
This was my first time making this mistake.
It turned out that I had called my program ProgramMame instead of ProgramName. CCP
It’s easy to do…
We hope this helps!