问题
I am getting this error when I try to link my application with ImageMagick++.
Undefined symbols for architecture x86_64:
"Magick::Image::read(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
...
I am using the latest OSX SDK (10.8)... and compiling to x86_64
My library was compiled this way:
./configure --disable-osx-universal-binary --without-perl --enable-shared --disable-static --without-pango --with-magick-plus-plus --with-quantum-depth=8
I added the library to the linker, but it's kind of ignoring the "-lMagick++-Q8"
I used "lipo -info" to double-check the architeture and it matched x86_64... so what else could it be?
here is the full linker command:
Ld /Users/MyUser/Library/Developer/Xcode/DerivedData/MyProject-cxtelbltlfqoftfcngpqxhiczxqs/Build/Products/Debug/libMyLib1.dylib normal x86_64
cd /Users/MyUser/Desktop/AllProject/Project1/MyLib1
setenv MACOSX_DEPLOYMENT_TARGET 10.8
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -L/Users/MyUser/Library/Developer/Xcode/DerivedData/MyProject-cxtelbltlfqoftfcngpqxhiczxqs/Build/Products/Debug -L/usr/local/lib -L/opt/local/lib -L/Users/MyUser/Desktop/AllProject/Project1/MyLib1/../../../../Library/Developer/Xcode/DerivedData/MyProject-cxtelbltlfqoftfcngpqxhiczxqs/Build/Products/Debug -L/usr/local/Cellar/glfw/2.7.7/lib -L/usr/local/Cellar/glew/1.9.0/lib -L/usr/local/Cellar/freetype/2.4.11/lib -L/usr/local/Cellar/imagemagick/6.8.4/lib -L/usr/local/Cellar/jpeg/8d/lib -L/usr/local/Cellar/libpng/1.5.14/lib -L/usr/local/Cellar/libtool/2.4.2/lib -F/Users/MyUser/Library/Developer/Xcode/DerivedData/MyProject-cxtelbltlfqoftfcngpqxhiczxqs/Build/Products/Debug -filelist /Users/MyUser/Library/Developer/Xcode/DerivedData/MyProject-cxtelbltlfqoftfcngpqxhiczxqs/Build/Intermediates/MyLib1.build/Debug/MyLib1.build/Objects-normal/x86_64/MyLib1.LinkFileList -install_name /usr/local/lib/libMyLib1.dylib -mmacosx-version-min=10.8 -stdlib=libc++ -lstdc++ -liconv -lbz2 -lz -framework OpenGL -llib_json -lSFTools -lavcodec -lavdevice -lavfilter -lavformat -lavutil -lpostproc -lGLEW.1.9 -lGLEW -lx264 -lGLEWmx.1.9 -lGLEWmx -lglfw -lpng15 -lpng15 -lfreetype -lfreetype -lltdl -ljpeg -lltdl -lMagick++-6.Q8 -lMagickCore-6.Q8 -lMagickWand-6.Q8 -lglfw -lswresample -lswscale -single_module -compatibility_version 1 -current_version 1 -o /Users/MyUser/Library/Developer/Xcode/DerivedData/MyProject-cxtelbltlfqoftfcngpqxhiczxqs/Build/Products/Debug/libMyLib1.dylib
来源:https://stackoverflow.com/questions/15927287/magick-not-linking-in-os-x-10-8