好吧,我知道此错误还有其他帖子,但我似乎无法找到解决我的问题的帖子。问题是当我尝试在Qt Creator中构建我的C ++项目时,我得到两个错误:1)symbol(s) not found for architecture x86_64
和2)linker command failed with exit code 1 (use -v to see invocation)
。代码构建并运行正常,直到我尝试使用FFTW-3.3.4库实现FFT。完整的编译器输出是:
14:55:10: Running steps for project RFdata...
14:55:10: Configuration unchanged, skipping qmake step.
14:55:10: Starting: "/usr/bin/make"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr /bin/clang++ -c -pipe -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDK s/MacOSX10.9.sdk -mmacosx-version-min=10.7 -Wall -W -fPIE -DQT_CORE_LIB - I../Qt/5.4/clang_64/mkspecs/macx-clang -I../RFdata -I../RFdata/fftw- 3.3.4/libbench2 -I../Qt/5.4/clang_64/lib/QtCore.framework/Versions/5/Headers -I. - I. -F/Users/Mike/Desktop/Qt/5.4/clang_64/lib -o main.o ../RFdata/main.cpp
../RFdata/main.cpp:93:22: warning: comparison of integers of different signs: 'long' and 'size_type' (aka 'unsigned long') [-Wsign-compare]
for (long i = 0; i < str.length(); ++i) //M:for loop that iterates through the length of the string and //replaces each occurance of a ch1 with ch2
~ ^ ~~~~~~~~~~~~
1 warning generated.
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr /bin/clang++ -c -pipe -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDK s/MacOSX10.9.sdk -mmacosx-version-min=10.7 -Wall -W -fPIE -DQT_CORE_LIB - I../Qt/5.4/clang_64/mkspecs/macx-clang -I../RFdata -I../RFdata/fftw- 3.3.4/libbench2 -I../Qt/5.4/clang_64/lib/QtCore.framework/Versions/5/Headers -I. - I. -F/Users/Mike/Desktop/Qt/5.4/clang_64/lib -o display_vector.o ../RFdata/display_vector.cpp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr /bin/clang++ -c -pipe -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDK s/MacOSX10.9.sdk -mmacosx-version-min=10.7 -Wall -W -fPIE -DQT_CORE_LIB - I../Qt/5.4/clang_64/mkspecs/macx-clang -I../RFdata -I../RFdata/fftw- 3.3.4/libbench2 -I../Qt/5.4/clang_64/lib/QtCore.framework/Versions/5/Headers -I. - I. -F/Users/Mike/Desktop/Qt/5.4/clang_64/lib -o convert_string.o ../RFdata/convert_string.cpp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr /bin/clang++ -headerpad_max_install_names -Wl,- syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/De veloper/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.7 -Wl,- rpath,/Users/Mike/Desktop/Qt/5.4/clang_64/lib -o RFdata main.o display_vector.o convert_string.o -F/Users/Mike/Desktop/Qt/5.4/clang_64/lib - L/Users/Mike/Desktop/RFdata/fftw-3.3.4/libbench2/ -lbench2 -framework QtCore - framework DiskArbitration -framework IOKit
Undefined symbols for architecture x86_64:
"_fftw_cleanup", referenced from:
hilbert() in main.o
"_fftw_destroy_plan", referenced from:
hilbert() in main.o
"_fftw_execute", referenced from:
hilbert() in main.o
"_fftw_plan_dft_1d", referenced from:
hilbert() 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)
make: *** [RFdata] Error 1
14:55:11: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project RFdata (kit: Desktop Qt 5.4.0 clang 64bit)
When executing step "Make"
14:55:11: Elapsed time: 00:01.
我完全没有链接库的经验,所以任何帮助都绝对是惊人的!我应该展示我的.pro文件所说的内容,因为根据我的理解,在.pro文件中添加正确的行可能是成功链接到库之间的区别而不是成功! 的.pro:
QT += core
QT -= gui
TARGET = RFdata
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp \
display_vector.cpp \
convert_string.cpp
HEADERS += \
display_vector.h \
convert_string.h
macx: LIBS += -L$$PWD/fftw-3.3.4/libbench2/ -lbench2
INCLUDEPATH += $$PWD/fftw-3.3.4/libbench2
DEPENDPATH += $$PWD/fftw-3.3.4/libbench2
macx: PRE_TARGETDEPS += $$PWD/fftw-3.3.4/libbench2/libbench2.a
所以,我想最重要的问题,虽然我意识到它是一个非常通用且可能很简单的问题,但我如何在我的mac上成功将fftw-3.3.4库链接到我的ct creator 3.3中的c ++项目(OSX 10.9.5)?????这让我疯了!
答案 0 :(得分:0)
看起来您正在尝试将32位库链接到64位可执行文件。要么寻找64位库,要么将其编译为32位程序。