I'm trying to use RtAudio and RtMidi together. I have in the same folder RtAudio.cpp, RtAudio.h, RtHelper.h, RtMidi.cpp and RtMidi.h as well as 2 test programs, midiprobe.cpp and audioprobe.cpp.
Compiling midiprobe with the default command works, but when I try to do the same for audioprobe to test RtAudio, I get the errors.
Here is what I use to compile:
g++ -Wall -D__MACOSX_CORE__ -o audioprobe audioprobe.cpp RtAudio.cpp -framework CoreAudio -lpthread
And these are the errors:
Undefined symbols for architecture x86_64:
"_CFRelease", referenced from:
RtApiCore::getDeviceInfo(unsigned int)in cc89M9Ki.o
"_CFStringGetCString", referenced from:
RtApiCore::getDeviceInfo(unsigned int)in cc89M9Ki.o
"_CFStringGetLength", referenced from:
RtApiCore::getDeviceInfo(unsigned int)in cc89M9Ki.o
"_CFStringGetSystemEncoding", referenced from:
RtApiCore::getDeviceInfo(unsigned int)in cc89M9Ki.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
I'm quite new to this sort of stuff (mostly had frameworks ready-made till now) and haven't been able to figure this out yet. Since it's the default example, I'm really lost as to what to do next...
Thanks in advanced.
The missing symbols are in the CoreFoundation framework - you need to add:
-framework CoreFoundation
to your command line.
Related
spent some time, with the big help of other SO user, trying to install Allegro library on osx 10.10.5
Finally it seems like it is ok, so I open the code blocks, pasted the example code( http://partitionseven.blogspot.com/2011/01/compiling-allegro-5-with-mac-os-x-snow.html), and I get an error while copiling
g++ -c /Users/lukasz/Desktop/test_allegro/test.cpp -o /Users/lukasz/Desktop/test_allegro/test.o
g++ -o /Users/lukasz/Desktop/test_allegro/test /Users/lukasz/Desktop/test_allegro/test.o
Undefined symbols for architecture x86_64:
"_al_clear_to_color", referenced from:
__al_mangled_main in test.o
"_al_create_display", referenced from:
__al_mangled_main in test.o
"_al_destroy_display", referenced from:
__al_mangled_main in test.o
"_al_flip_display", referenced from:
__al_mangled_main in test.o
"_al_install_system", referenced from:
__al_mangled_main in test.o
"_al_map_rgb", referenced from:
__al_mangled_main in test.o
"_al_rest", referenced from:
__al_mangled_main in test.o
"_main", referenced from:
implicit entry/start for main executable
(maybe you meant: __al_mangled_main)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
when I follow the tutorial exactly running the code from terminal with
gcc alleg5test.c -o alleg5test -L/usr/local/lib -lallegro -lallegro_main
./alleg5test
it works- i got a black screen. But how do I make it work from Code Blocks?
The following is returned when trying to compile part of a project under OSX:
gcc -g -pipe -L/Projects/export buf_test.o buf.o -framework CoreFoundation -o buf_test
Undefined symbols for architecture x86_64:
"___assert_rtn", referenced from:
_init in buf.o
_get in buf.o
_put in buf.o
"___sprintf_chk", referenced from:
_test in buf_test.o
"___strcpy_chk", referenced from:
_test_data_copy in buf_test.o
___inline_strcpy_chk in buf_test.o
"_exit", referenced from:
start in crt1.10.6.o
"_printf", referenced from:
_test in buf_test.o
"_puts", referenced from:
_test in buf_test.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
Help would be much appreciated!
Turns out it was a library naming conflict with the standard libraries -- I had a library called libSystem.a in /Projects/export which was masking libSystem.dylib from being found.
when I try to compile and run the gmp-chudnovsky.c file found here with xcode the following errors appear:
Undefined symbols for architecture x86_64:
"_fac_clear", referenced from:
_main in main.o
"_fac_compact", referenced from:
_fac_remove_gcd in main.o
"_fac_init", referenced from:
_main in main.o
"_fac_mul", referenced from:
_bs in main.o
"_fac_mul_bp", referenced from:
_bs in main.o
"_fac_resize", referenced from:
_fac_remove_gcd in main.o
"_fac_set_bp", referenced from:
_bs in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I know the gmp library is installed correctly as I have another xcode project linking to it that is compiling correctly. Any ideas as to why this is happening?
Forgot to say I have added paths to the header file and library for GMP as well as add the -lgmp flag under Other Linker Flags
SOLVED: see this answer.
I think xcode runs in a Debug configuration first, where no optimization is performed and no inlining is carried out. This means any inline function must also be made static.
I'm trying to compile basic plugin for firefox and linker reports following problem:
Undefined symbols for architecture i386:
"_NPN_GetValue", referenced from:
_PluginLog in main.o
"_NPN_GetStringIdentifier", referenced from:
_PluginLog in main.o
"_NPN_GetProperty", referenced from:
_PluginLog in main.o
"_NPN_Invoke", referenced from:
_PluginLog in main.o
"_NPN_ReleaseObject", referenced from:
_PluginLog in main.o
"_NPN_ReleaseVariantValue", referenced from:
_PluginLog in main.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
have I missed to add some linked libraries?
You can't just call those functions like you would a normal function (they aren't exported by a browser, nor are you linking against a browser); you need to use the function pointers from the NPNetscapeFuncs struct passed to you by the browser.
I'm trying to compile a C/C++ program that uses SDL on a OS X 10.6.8 but I'm having some errors on the linking stage, the code compiles but fails to like due to some missing symbols. The error is:
Undefined symbols for architecture x86_64:
"_CFBundleGetMainBundle", referenced from:
-[SDLMain setupWorkingDirectory:] in libSDLmain.a(SDLMain.o)
_main in libSDLmain.a(SDLMain.o)
"_CFBundleCopyBundleURL", referenced from:
-[SDLMain setupWorkingDirectory:] in libSDLmain.a(SDLMain.o)
"_CFURLCreateCopyDeletingLastPathComponent", referenced from:
-[SDLMain setupWorkingDirectory:] in libSDLmain.a(SDLMain.o)
"_CFURLGetFileSystemRepresentation", referenced from:
-[SDLMain setupWorkingDirectory:] in libSDLmain.a(SDLMain.o)
"_CFRelease", referenced from:
-[SDLMain setupWorkingDirectory:] in libSDLmain.a(SDLMain.o)
...
"_OBJC_CLASS_$_NSAutoreleasePool", referenced from:
objc-class-ref in libSDLmain.a(SDLMain.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [dist/linwarrior] Error 1
I checked with the file command and the libraries are either x86_64 only or universal with both i386 and x86_64 versions.
Is there a way for me to determine what exactly is causing this error? A way to check the libs that are being included or any way to help debug the problem?
I don't know if it helps but this is what my Makefile creates, I removed file names to make it short, and the KNT flag is just something I'm using for preprocessor conditions:
/opt/local/bin/g++-mp-4.5 -DKNT=1 -Wp,-M,-MP,-MT,-MF, -std=c++0x -Wall -I source -O1 -funroll-loops -c -o
Thanks.