xcode 体系结构 x86_64 的未定义符号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7675478/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 22:04:41  来源:igfitidea点击:

Undefined symbols for architecture x86_64

xcodelinkerimagemagick

提问by user978732

I am trying to use imagemagick in Xcode, and I am getting this error :

我正在尝试在 Xcode 中使用 imagemagick,但出现此错误:

Ld /Users/sarashafaei/Library/Developer/Xcode/DerivedData/test4-bwkmkpnssqhpxgfntgtgkmzrcskr/Build/Products/Debug/test4 normal x86_64
    cd /Users/sarashafaei/Desktop/test/test4
    setenv MACOSX_DEPLOYMENT_TARGET 10.7
    /Developer/usr/bin/g++-4.2 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.7.sdk -L/Users/sarashafaei/Library/Developer/Xcode/DerivedData/test4-bwkmkpnssqhpxgfntgtgkmzrcskr/Build/Products/Debug -L/usr/local/lib -L/usr/local/lib/ImageMagick -L/usr/local/lib/ImageMagick-6.7.2 -L/usr/local/lib/pkgconfig -L/usr/local/lib/ImageMagick/modules-Q16 -L/usr/local/lib/ImageMagick-6.7.2/modules-Q16 -L/usr/local/lib/ImageMagick/modules-Q16/coders -L/usr/local/lib/ImageMagick/modules-Q16/filters -L/usr/local/lib/ImageMagick-6.7.2/modules-Q16/coders -L/usr/local/lib/ImageMagick-6.7.2/modules-Q16/filters -F/Users/sarashafaei/Library/Developer/Xcode/DerivedData/test4-bwkmkpnssqhpxgfntgtgkmzrcskr/Build/Products/Debug -filelist /Users/sarashafaei/Library/Developer/Xcode/DerivedData/test4-bwkmkpnssqhpxgfntgtgkmzrcskr/Build/Intermediates/test4.build/Debug/test4.build/Objects-normal/x86_64/test4.LinkFileList -mmacosx-version-min=10.7 -o /Users/sarashafaei/Library/Developer/Xcode/DerivedData/test4-bwkmkpnssqhpxgfntgtgkmzrcskr/Build/Products/Debug/test4

Undefined symbols for architecture x86_64:
  "Magick::InitializeMagick(char const*)", referenced from:
      _main in main.o
  "Magick::Image::Image(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      _main in main.o
  "Magick::Image::~Image()", referenced from:
      _main in main.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

Any help would be appreciated.

任何帮助,将不胜感激。

回答by thiton

Even though you have a nice and long linker line, I can't find any missing -lImageMagickin there. You need to add this flag at the end of your linker/compiler invocation to actually link to the Magick library.

即使您有一个漂亮而长的链接器行,我也找不到其中的任何缺失-lImageMagick。您需要在链接器/编译器调用的末尾添加此标志以实际链接到 Magick 库。