-2
#include <iostream>
#include <string>
using namespace std;

int main()
{
// declare variables
    string name; 
    float fahrenheit, celcius;
//display greeting
    cout << "Please enter your first name: ";
    cin >> name;
//ask for fahrenheit
    cout << "Enter a temperature in Fahrenheit degrees please: ";
    cin >> fahrenheit;
//write equation
    celcius = 5.0f/9.0f * (fahrenheit - 32.0f);
//display result
    cout << "Hi " << name << endl << endl;
    cout << "The equivalent to " << fahrenheit << "degrees Fahrenheit is" << celcius << "degrees Celcius" << endl << endl;

return 0;
}

I'm not sure what exactly is incorrect I have checked so many times and played with the code to get rid of the errors to no avail. Any help is appreciated.

Nora
  • 11
  • 1
  • 9
  • And what is the exact error message? – Buddy Sep 24 '15 at 00:07
  • 1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup 1>C:\Users\Nora\Documents\Visual Studio 2008\Projects\Project1\lab2T13\Debug\lab2T13.exe : fatal error LNK1120: 1 unresolved externals – Nora Sep 24 '15 at 00:09
  • 1
    I think you need to configure the project as a console project (not a win32 application) – Buddy Sep 24 '15 at 00:11
  • I'm using win32 as instructed by the professor so there's no changing that – Nora Sep 24 '15 at 00:17
  • 2
    Talk to you professor. – Thomas Matthews Sep 24 '15 at 00:21

2 Answers2

1

Change int main() to:

int _tmain(int argc, _TCHAR* argv[])

Here's a Hello World sample program to look at.

Buddy
  • 10,874
  • 5
  • 41
  • 58
0

as an explanation for you

the code you have typed is perfectly correct. It compiles cleanly. But the way things have been setup to complete the process to make a running app ('linking') is failing.

The linker is expecting to find an entry point called _WinMain (hence the error message). This is because when you created the project you said it was a windows app - which its not. YOu need to ask you prof

Also - when asking "why do I get this error?" always include the error in the question

pm100
  • 48,078
  • 23
  • 82
  • 145