문제

I'm trying to learn how to use libfreenect with the PCL library in C++ using Qt Creator. I'm a n00b with c++ so eventually I ran into an error compiling a sample:

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 is built for the i386 architecture on my machine (running osx 10.6.8). I notice the default Make run by Qt Creator does this:

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 

Is there a Qt flag I can set in the .pro file so the architecture is set to i386 instead of x86_64 ?

도움이 되었습니까?

해결책

FOO = -arch i386
LIBS = -arch i386
LIBS += $$FOO

or

CONFIG += i386

EDIT

To set Qt for specific architecture you have to run you Command Prompt, enter your Qt dir and run:

configure -embedded i386 -no-webkit

After confirm you'll have to wait a while and later follow instructions. Here you have other flags for configure. It will configure your Qt and then you will recompile binaries. You'll be instructed how to do it after configure.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top