Question:
I just started a C++ Course in my High School and when I try and compile the code I get a fatal error?
2008-10-10 11:30:12 UTC
Here is the error and the source code.

fatal error LNK1169: one or more multiply defined symbols found



// Mad-lib program
// Asks user to enter in a short list of nouns,
// verbs, numbers etc...  and then uses these
// entries to make a funny story.

// Program Header
// -------------------------------------------------------
#include
#include // for system ("cls")
#include  // for getch()
#include
using namespace std;

// Function Prototypes
// -------------------------------------------------------

// none

// Body of the Program
// -------------------------------------------------------

int main ()
{
//Variables that will be used to store
//the words provided by the user...
string schoolName;
string subjectOne;
string subjectTwo;
string headMaster;
string userName;
string itemOne;
string itemTwo;
string firstMonth;
int firstMonthDay;
string animal;
string secondMonth;
int secondMonthDay;
string headMistress;

//The opening title and info
cout << "MAD - LIBS!!" << endl << endl;
cout << "Provide a word or number at each" << endl;
cout << "of the following prompts..." << endl;
cout << "Your entries will be used to create" << endl;
cout << "a silly story!!" << endl << endl;
cout << "***************************" << endl << endl;

//Prompt the user for data
cout << "Enter in a famous person's last name: ";
cin >> schoolName;
cout << "What subject are you really good at? "
<< "(one word): ";
cin >> subjectOne;
cout << "What subject are you not so good at? "
<< "(one word): ";
cin >> subjectTwo;
cout << "Enter the name of your favorite pet "
<< "(one word): ";
cin >> headMaster;
cout << "Enter your first name: ";
cin >> userName;
cout << "Enter in a plural noun: ";
cin >> itemOne;
cout << "Enter in another plural noun: ";
cin >> itemTwo;
cout << "What month were you born in? "
<< "(spell it out): ";
cin >> firstMonth;
cout << "What day were you born on? "
<< "(use an integer): ";
cin >> firstMonthDay;
cout << "What is your favorite animal?: ";
cin >> animal;
cout << "What is the current month? "
<< "(spell it out): ";
cin >> secondMonth;
cout << "What is the current day? "
<< "(use an integer); ";
cin >> secondMonthDay;
cout << "Enter the first name of your best friend: ";
cin >> headMistress;

//Display the funny story using the entries
//provided by the user.
system("cls"); //Clear the screen
cout << "Here is your mad - lib!!" << endl;
cout << "****************************" << endl <cout << schoolName << "'s School of "
<< subjectOne << " and "
<< subjectTwo << endl << endl;
cout << "Headmaster:  " << headMaster << endl << endl;
cout << "Dear " << userName << "," << endl;
cout << "\tWe are pleased to inform you that you have"
<< endl;
cout << "been accepted at " << schoolName
<< "'s School of " << endl;
cout << subjectOne << " and " << subjectTwo
<< ".  Please" << endl;
cout << "find enclosed a list of all necessary "
<< itemOne << endl;
cout << "and " << itemTwo << "." << endl;
cout << "\tTerm begins on " << firstMonth << " "
<< firstMonthDay;
cout << ".  We await" << endl;
cout << "your " << animal << " by no later than "
<< secondMonth;
cout << " " << secondMonthDay << "."
<< endl;
cout << "Yours sincerely," << endl << endl;
cout << headMistress << endl;
cout << "Deputy Headmistress" << endl << endl;
getch(); //Make the program pause before
//it stops running so that the
//user can read their mad - lib
//before it disappears.

return 0;

}
Four answers:
The Phlebob
2008-10-10 19:00:03 UTC
I suspect you have a compile-time option set wrong in the IDE for the project and it's pulling in two copies of the same library. If you can cross-check the options with another, working program's set, (another student, possibly) you should be able to find the problem.



Also, turning on all compile- and link-time error messages should give you more information in the Output window.



Good luck.
2016-12-02 09:35:30 UTC
there are various Universities that supply extreme college degree courses by using distance gaining wisdom of (correspondence and on line). they're in many cases much less high priced than on line extreme college "agencies" and that they are a hundred% valid. 3 that I at present understand approximately are (i'm discovering to locate greater of those): Indiana college (training + degree) Harvard college (training yet no HS degree, AA a threat) Missouri college (training + degree) i've got faith all 3 additionally supply twin credit recommendations (earn extreme college and school credit concurrently). Affordability? i'm uncertain the thank you to interpret your wording. in case you advise $500 in line with 3 hundred and sixty 5 days, all of those bypass over your funds. in case you advise $500 in line with direction, the only one over your funds is Harvard. in case you advise $500 in line with semester, IU and MU are interior that funds. the 1st hyperlink below will take you to all 3. *** you additionally can desire to look into MIT Open Courseware (unfastened) yet would not supply any credit / degree (2d hyperlink)
Rah-Mon Heur
2008-10-10 12:47:14 UTC
It also compile / link without errors for me on visual c++ 2005 sp1.



Did you tried to clean it and rebuild your project?
soooooooo
2008-10-10 11:46:51 UTC
There is no Error. Try it in Dev C++. It runs without any errors


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...