I have a quick question with visual studio. This is the first program I have ever tried with the 2010 version and get the following error...

1>------ Build started: Project: test, Configuration: Debug Win32 ------
1>Build started 1/17/2010 4:53:30 PM.
1> Touching "Debug\test.unsuccessfulbuild".
1> All outputs are up-to-date.
1> All outputs are up-to-date.
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>C:\Documents and Settings\Bryan Kruep\My Documents\test\Debug\test.exe : fatal error LNK1120: 1 unresolved externals
1>Build FAILED.
1>Time Elapsed 00:00:09.67
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Can someone familar with 2010 let me know what I am doing wrong because I cannot seem to figure it out whether I have a setting wrong or something not installed correctly. Here is my code...

//This program calculates the user's pay
#include <iostream>
using namespace std;

int main ()
	double hours, rate, pay;

	//Get the number of hours worked
	cout << "How many hours did you work? ";
	cin >> hours;

	//Get the hourly pay rate
	cout << "How much do you get paid per hour? ";
	cin >> rate;

	//Calculate the pay
	pay = hours * rate;

	//Display the pay
	cout << "You have earned $" << pay << endl;

	return 0;
8 Years
Discussion Span
Last Post by jbennet

When you select a project go for Win32 Console Application, deselect precompiled headers and leave empty project unchecked. That usually takes care of it. I'm behind on the times as I don't have the latest and greatest yet but seems to me most of that is unchanged.


Yep, seems you created the wrong sort of app (its expecting a WinMain, which is part of a graphical app, you want a console application).

I know in VS2008 (p,s i think 2008 is way better than 2010), you choose new project -> C++ -> Win32 -> Win32 Console application and make sure you DONT tick anything like precompiled header, CLR, MFC, ATL etc.......

DO not choose Win32 project. You want Win32 Console application.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.