I am new to Xcode and when I build the following code (an MWE), I get the following error
ld: 3 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have three files as following;
main.cpp
#include "B.cpp"
int main() {
square(5);
return 0;
}
B.cpp
#include "A.cpp"
void square(int n){
display(n*n);
}
A.cpp
#include <iostream>
using namespace std;
void display(int num){
cout<<num;
}
I have tried different methods mentioned on stack overflow like change "Build Active Architecture Only" to "Yes" and some others but the error still persists.
Can you please elaborate how to compile and build "Main.cpp" independently. P.S. I am using XCode 6.1.1 – Ahmad Dec 12 '14 at 05:18