c++ - Mach-O error when trying to compile in Xcode -


i'm working on c++ program in xcode, , keep getting mach-o error when try build , run app (plus "build failed" error message). below code i'm using:

// //  quadsolver.cpp //  calculator // // #include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> using namespace std;  int main(int nnumberofargs, char* pszargs[]) {     //enter 3 variables     double a;     double b;     double c;     cout << "enter a";     cin >> a;      cout << "enter b";     cin >> b;      cout << "enter c";     cin >> c;      //calculating discriminant     double d;     d = b * b - 4 * * c;     double x1, x2;      if (d == 0)     {         x1 = x2 = -b / (2 * a);         cout << "there's 1 solution: ";         cout << x1;         system("pause");         return 0;     }      else if (d < 0)     {         cout << "there no possible solutions, discriminant smaller zero";         system("pause");         return 0;     }     else if (d > 0)     {         x1 = (-b - sqrt(d)) / (2 * a);         x2 = (-b + sqrt(d)) / (2 * a);         cout << "there 2 solutions:";         cout << "x1=";         cout << x1;         cout << "x2=";         cout << x2;     } } 

and error message along lines of:

ld: duplicate symbol _main in /users/myusername/library/developer/xcode/deriveddata/calculator-cwpaasypxtqkpvfsbfjekrgrgvbq/build/intermediates/calculator.build/debug/calculator.build/objects-normal/x86_64/quadsolver.o , /users/myusername/library/developer/xcode/deriveddata/calculator-cwpaasypxtqkpvfsbfjekrgrgvbq/build/intermediates/calculator.build/debug/calculator.build/objects-normal/x86_64/main.o architecture x86_64 

your main function defined in 2 places. in little program there , in source file named main, came part of template. i'm not sure template used, in project file named main , remove or comment out implementation of main function.


Comments

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -