error LNK2019: unresolved external symbol

Hello,
I'm trying to learn C++ and compile a program to swap between letters in a string.

#include <iostream>

using namespace std;

void swap (char *a, char *b)
{
char temp;
temp = *a;
*a = *b;
*b = temp;
}

void main ()
{
char *str = "ab";
cout << *str;
swap (str, str+1);
cout << *str;
}

and here is the error I receive:

error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup

can someone help me to overcome this?
Sounds like you selected a Windows application instead of a console application when you defined your project.

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
Last edited on
Topic archived. No new replies allowed.