Advertisement

Any idea what i did wrong?

Started by July 12, 2014 02:31 PM
1 comment, last by destluck 10 years, 6 months ago

Alright i keep getting 2 errors:

Error 1 error LNK2005: _main already defined in main.obj

Error 2 error LNK1169: one or more multiply defined symbols found


#include<iostream>
#include <string>
#include <random>
#include <time.h>


using namespace std;

class Player
{
	public:	
		
		string mFirstName;
		string mLastName;
		string mStreetName;
		string mGender;

		int mAdress;
		int mAge;

	};


Player GetPlayerFromConsole()
{
	
	Player npc;

	cout << " New Player Signup: " << endl;


	cout << "Enter your first name: " << endl;
	cin >> npc.mFirstName;
	
	cout << "Enter your last name: " << endl;
	cin >> npc.mLastName;

	cout << " Enter your Age: " << endl;
	cin >> npc.mAge;

	cout << "Enter your Gender: " << endl;
	cin >> npc.mGender;

	cout << "Enter your Street name: " << endl;
	cin >> npc.mStreetName;

	cout << "Enter your adress: " << endl;
	cin >> npc.mAdress;

	return npc;
}

int main()
{

	Player newPlayer;

	newPlayer = GetPlayerFromConsole();

	cout << "New Player info Sheet: " << endl;
	cout << "Player name: " << newPlayer.mFirstName << endl;
	cout << newPlayer.mFirstName << endl;
	cout << "Player Adress: " << newPlayer.mAdress << newPlayer.mStreetName << endl;
	cout << "Player Gender: " << newPlayer.mGender << endl;

	cin.get();
        system("pause");
	return 0;
	

	}

Looks like you have more than one 'main' function in your project. Check here.

Advertisement

ty

This topic is closed to new replies.

Advertisement