Keep receiving error LNK2019 and cant seem to locate where the issue lies.

Good Morning Everyone!
I need some assistance... I keep receiving the error LNK2019: unresolved external symbol_main referenced in function__tmainCRTStartup.fatal error LNK1120: 1 unresolved externals.

I cant seem to figure out where I went wrong. Could anybody please point me out in the right direction.. I even went in and created a new Project and still received the same error.

/*
Write a simple calculator program. Ask the user if s/he wants to add ('+') subtract ('-'), multiply ('*')
or divide ('/') and then ask for the number. Perform the operation with the given number. Start the "display"
at zero. Stop when the user enters 'X' (for exit).
*/

#include <iostream>
#include <string>

using namespace std;

int main ()
{
char operation;
int total;

if (total == 0)
{
cout << "Can not divide by zero!";
}

do
{
cout << "Enter an operation: + - * / (or enter X to exit): " << endl;
cin >> operation;
cout << operation << endl;
}
while(operation = "X");
}

I have tried to searching online and going thru forums but cannot seem to find anything that can help me..

Thank you,
Karen
You're trying to compile a Windows application. When creating a project, create a Win32 console application.
what kind of project are u using?
what compiler are you using?

btw you should put if (total == 0) {... in the do-while-loop.
and while (operation = "X") has to be while (operation == 'X'), " " for strings and ' ' for chars ;-)

oh, helios was faster.. :-D
Last edited on
Hi there!
I am using C++, I select Win32 and select Win32 Console Application.

Karen
can you choose a helloWorld-project?
i think in visual studio was something like that (but its been years since i last used VS).
if something like this is selectable, run it, if it works (and it should) copy your code in the project and run it again.

i can compile your code without any problems (using g++ on ubuntu), so there has to be a problem with your projecttype i think
Last edited on
It worked... Thank you so much ;)

Now working on another issue.... Thanks again :)
Topic archived. No new replies allowed.