Visual C++ 2010 - fatal error LNK1169: one or more multiply defined symbols found

Suhail Gupta picture Suhail Gupta · Jun 28, 2011 · Viewed 48.3k times · Source

this is a program :

#include <iostream>
using namespace std;

int main() {
cout << "Enter a number";
int i;
cin >> i;
try {
    if( i == 0 ) throw 0;
    if( i == 2 ) throw "error";
} catch( int i ) {
    cout << "can't divide by 0";
 }
   catch( ... ) {
       cout << "catching other exceptions";
   }
}

On compiling (Microsoft visual C++ 2010 express on Windows 7), I get the error which says:

fatal error LNK1169: one or more multiply defined symbols found

Answer

saplingPro picture saplingPro · Jun 28, 2011

Actually there is no error in this code.

Number of source files could be the problem. Try this code as a new project in the same compiler or try deleting the files from the source files option in the left side of Text Area (i.e where you are writing your code)

This should compile then.