OS X编译错误:找不到架构x86_64

时间:2015-05-08 15:48:48

标签: c++ xcode macos makefile

新编译在这里,所以请耐心等待。我正在尝试使用make在OS X 10.10.3上编译一些c ++代码。我安装了XCode 6.3.1。我的Makefile是使用qmake生成的。编译器运行良好,直到它尝试运行最终的构建命令并抛出错误:

Undefined symbols for architecture x86_64:
  "_iconv", referenced from:
      puntoexe::charsetConversionIconv::myIconv(void*, char*, unsigned long) const in charsetConversionIconv.o
  "_iconv_close", referenced from:
      puntoexe::charsetConversionIconv::close() in charsetConversionIconv.o
  "_iconv_open", referenced from:
      puntoexe::charsetConversionIconv::initialize(int) in charsetConversionIconv.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [dicom2jpeg.app/Contents/MacOS/dicom2jpeg] Error 1

我在这里找到了多个线程来描述类似的问题,显然它归结为链接到32位库的编译器。适用于其他人的主要建议是将以下代码添加到Makefile中:

-stdlib=libstdc++

qmake生成的Makefile如下所示:

CC            = clang
CXX           = clang++
DEFINES       = -DQT_NO_DEBUG
CFLAGS        = -pipe -mmacosx-version-min=10.7 -O2 -arch x86_64 -Wall -W $(DEFINES)
CXXFLAGS      = -pipe -stdlib=libc++ -mmacosx-version-min=10.7 -O2 -arch x86_64 -Wall -W $(DEFINES)
INCPATH       = -I/usr/local/Cellar/qt/4.8.6/mkspecs/unsupported/macx-clang-libc++ -I. -I/usr/local/Cellar/qt/4.8.6/include -I.
LINK          = clang++
LFLAGS        = -headerpad_max_install_names -stdlib=libc++ -mmacosx-version-min=10.7 -arch x86_64
LIBS          = $(SUBLIBS)  -L/usr/local/Cellar/qt/4.8.6/lib -lpthread

所以,我已经将Makefile更改为链接到相应的库:

CC            = clang
CXX           = clang++
DEFINES       = -DQT_NO_DEBUG
CFLAGS        = -pipe -mmacosx-version-min=10.7 -O2 -arch x86_64 -Wall -W $(DEFINES)
CXXFLAGS      = -pipe -stdlib=libstdc++ -mmacosx-version-min=10.7 -O2 -arch x86_64 -Wall -W $(DEFINES)
INCPATH       = -I/usr/local/Cellar/qt/4.8.6/mkspecs/unsupported/macx-clang-libc++ -I. -I/usr/local/Cellar/qt/4.8.6/include -I.
LINK          = clang++
LFLAGS        = -headerpad_max_install_names -stdlib=libstdc++ -mmacosx-version-min=10.7 -arch x86_64
LIBS          = $(SUBLIBS)  -L/usr/local/Cellar/qt/4.8.6/lib -lpthread

但是,没有骰子。仍然在最终构建中抛出相同的错误。我错过了什么吗?

0 个答案:

没有答案