xCode produces "Undefined symbols for architecture x86_64" error while gcc compiles without errors

300 views Asked by At

When compiling a demo program for a library with xCode, I get an undefined symbols error. The same C code compiles without any problems with gcc test.c -pthread -ltraffic. I did set the compiler flags I. xCode without any success.

What does xCode do differently than gcc? Don't they both use LLVM?

1

There are 1 answers

2
Misha On

The problem is that all your external libraries (pthread, traffic, etc..) have to be compiled for both i386 and x86_64 architectures. This means that you have to have either two library files for each library or one "fat" library file (see here).