Reputation: 43
I am trying to build a C source file based on Linphone in Mac OS X Sierra but getting the following error.
This is the link for the C source file. http://www.linphone.org/docs/liblinphone/group__basic__call__tutorials.html
Edited:
I am trying to compile the source code with this command
clang -o tt tt.c -I/Users/softdev/Downloads/linphone-sdk-3.11.1-mac/include/
Error:
Undefined symbols for architecture x86_64
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have tried to change the target cpu but didn't work.
My system has XCode 8. Any help regarding this will be appreciated.
Edited: Complete Output
Undefined symbols for architecture x86_64: "_linphone_call_get_state", referenced from: _main in tt-ca2045.o "_linphone_call_ref", referenced from: _main in tt-ca2045.o "_linphone_call_unref", referenced from: _main in tt-ca2045.o "_linphone_core_destroy", referenced from: _main in tt-ca2045.o "_linphone_core_invite", referenced from: _main in tt-ca2045.o "_linphone_core_iterate", referenced from: _main in tt-ca2045.o "_linphone_core_new", referenced from: _main in tt-ca2045.o "_linphone_core_terminate_call", referenced from: _main in tt-ca2045.o "_ms_usleep", referenced from: _main in tt-ca2045.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Upvotes: 4
Views: 12515
Reputation: 89509
I got the sample code to compile using this:
clang -o hello hello.c -Ilinphone-sdk-3/include -Llinphone-sdk-3/lib -llinphone -lmediastreamer_base
Clang's -I
parameter points to the where the header (.h) files live
And as for my additions, -L
specifies the path for clang to get to where the lib files live. In your case, it might live in -L/Users/softdev/Downloads/linphone-sdk-3.11.1-mac/lib
then -l
specifies which dylibs you want to include (strip off the lib
prefix and the dylib
suffix).
Lastly, you need to add a missing line to the sample code you pointed to. Add:
#include <unistd.h>
after signal.h
Upvotes: 4