#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
std::cout << "Enter two numbers:" << std::endl;
int v1=0,v2=0;
std::cin >> v1>>v2;
std::cout << "The sum of "<<v1<<"and "<<v2<<"is" <<v1+v2 <<std::endl;
return 0;
}
运行以后出现错误提示:
duplicate symbol _main in:
/Users/guokairui/Library/Developer/Xcode/DerivedData/cpp-bkvtklkrghfimsghpbbkiqyxgrbl/Build/Intermediates/cpp.build/Debug/cpp.build/Objects-normal/x86_64/cpp0.o
/Users/guokairui/Library/Developer/Xcode/DerivedData/cpp-bkvtklkrghfimsghpbbkiqyxgrbl/Build/Intermediates/cpp.build/Debug/cpp.build/Objects-normal/x86_64/main.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
#include <stdlib.h>
using namespace std;
int main()
{
std::cout << "Enter two numbers:" << std::endl;
int v1=0,v2=0;
std::cin >> v1>>v2;
std::cout << "The sum of "<<v1<<"and "<<v2<<"is" <<v1+v2 <<std::endl;
return 0;
}
运行以后出现错误提示:
duplicate symbol _main in:
/Users/guokairui/Library/Developer/Xcode/DerivedData/cpp-bkvtklkrghfimsghpbbkiqyxgrbl/Build/Intermediates/cpp.build/Debug/cpp.build/Objects-normal/x86_64/cpp0.o
/Users/guokairui/Library/Developer/Xcode/DerivedData/cpp-bkvtklkrghfimsghpbbkiqyxgrbl/Build/Intermediates/cpp.build/Debug/cpp.build/Objects-normal/x86_64/main.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)