Can you help?

Im getting this error and i'm a relative neophyte to programming so could some help me?

"fatal error LNK1169: one or more multiply defined symbols found"


Here's my code:#include "stdafx.h"
#include <iostream>
using namespace std;

int main ()
{
cout << "Avoiding Technology" << endl;
bool status = true;
int location;
int a,b;

a = 1;
b = 2;

cout<< " You start at your desk, waking a up from a nap."<< endl;
cout << " The bus for school comes in 10 minutes" << endl;
cout <<" What do you want to do?"<< endl;
cin >> location;

switch (location){





case 0:
{cout <<" _________________" << endl;
cout <<" / /|" << endl;
cout <<" / / |" << endl;
cout <<" /________________/ /|" << endl;
cout <<" ###| ____ |//|" << endl;
cout <<" # | / /| |/.|" << endl;
cout <<" # __|___ / /.| | |_______________" << endl;
cout <<" # / / //|| | / /| ___" << endl;
cout <<" # / /___// || | / / | / \\ \"" << endl;
cout <<" # /______/! || ||_____|/ / | / \\ \"" << endl;
cout <<" #| . . . ! || || / _________________/ \\ \"" << endl;
cout <<" #| . . ! || // ________ / /\\________________ { / }" << endl;
cout <<" /| . ! ||//~~~~~~/ 0000/ / / / ______________ { / /" << endl;
cout <<" / | ! |'/ /9 0000/ / / / / / { / /" << endl;
cout <<" / #\\________!___|/ /9 0000/ / / / /_____________/___ / /" << endl;
cout <<" / # /_____\\/ /9 0000/ / / / /_ /\\_____________\\/ /" << endl;
cout <<" / # ``^^^^^^ / \\ \\ . ./ / ____________ /" << endl;
cout <<" +=#==================================/ \\ \\ ./ / /. . . \\ / /" << endl;
cout <<" |# | \\ \\/ / /___________/ /" << endl;
cout <<" # |_______\\__/________________/" << endl;
cout <<" | | | | / / " << endl;
cout <<" | | | | / / " << endl;
cout <<" | | ________| |/ /________ " << endl;
cout <<" | | /_______/ \\_________/\\ " << endl;
cout <<" | | / / / \\ ) " << endl;
cout <<" | | /OO^^^^^^/ / /^^^^^^^^^OO\\) " << endl;
cout <<" | | / / / " << endl;
cout <<" | | / / /" << endl;
cout <<" | | /___\\/" << endl;
cout <<" | | oo" << endl;
cout <<" |____________________________________|" << endl;
cout<< " You start at your desk, waking a up from a nap."<< endl;
cout << " The bus for school comes in 10 minutes" << endl;
cout <<" What do you want to do left(l) or right(r)?"<< endl;
cin >> location;
if (location =='r'){
cout << "You got right to the door"<< endl;
location = 1;}
else if (location =='l'){
cout << "You went left to your computer your suppose to avoid technology"<< endl;}
location =2;
}
case 1: cout << "You end up in a hallway.. What do you want to do b,r,l.?"<< endl;

if(location == 'b'){
cout << "You went back in to your room"<< endl;
}
case 2:{ cout <<"Die bitch fucking avoid technology" << endl;
}

}


system ("pause");
return 0;

}
Last edited on
Your program compiles without error. The error you are getting is a linker error for having something defined multiple times - are you accidentally compiling two programs (two main functions) in the same project?
Are you selecting a console application as your project type?
If you select a Windows application, main() will be supplied and your use of main will be detected as a duplicate symbol.

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.
Thank you both for your help I had written my code in the stdafx.h file as well as the original
Topic archived. No new replies allowed.