我正在尝试学习如何使用 Qt Creator 在 C++ 中将 libfreenect 与 PCL 库一起使用。我是使用 c++ 的 n00b,所以最终我在编译示例时遇到了错误:
ld: warning: in /usr/local/lib/libfreenect.dylib, file was built for i386 which is not the architecture being linked (x86_64)
make: Leaving directory `/Users/george/Documents/Qt/OKPCL'
Undefined symbols:
"_freenect_init", referenced from:
Freenect::Freenect::Freenect()in OKPCL.o
"_freenect_select_subdevices", referenced from:
Freenect::Freenect::Freenect()in OKPCL.o
"_freenect_process_events", referenced from:
Freenect::Freenect::operator()()in OKPCL.o
"_freenect_shutdown", referenced from:
Freenect::Freenect::~Freenect()in OKPCL.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [OKPCL] Error 1
The process "/usr/bin/make" exited with code 2.
Error while building project OKPCL (target: Desktop)
When executing build step 'Make'
libfreenect 是为我的机器上的 i386 架构构建的(运行 osx 10.6.8)。我注意到 Qt Creator 运行的默认 Make 是这样做的:
make: Entering directory `/Users/george/Documents/Qt/OKPCL'
g++ -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -o OKPCL main.o OKPCL.o -F/Users/george/QtSDK/Desktop/Qt/474/gcc/lib -L/Users/george/QtSDK/Desktop/Qt/474/gcc/lib /usr/local/lib/libfreenect.dylib /usr/local/lib/libpcl_io.dylib /usr/local/lib/libpcl_common.dylib -framework QtCore
我可以在 .pro 文件中设置一个 Qt 标志,以便将架构设置为 i386 而不是 x86_64 吗?