我开车疯了...... 我正在制定一个程序,用OpenNI和NiTE从Xtion Primesense传感器中读出联合坐标。我分三部分得到了程序splittet。 Main,sensorOpenNI.hpp和sensorOpenNI.cpp。现在,在将各个部分链接在一起时,我收到很多错误,说有一些NiTE函数的未定义引用。我正在使用Kubuntu和g ++。 NiTE和OpenNI库位于名为Include的目录中...... 这是错误消息:
/tmp/ccrPQHEg.o:在函数
openni::VideoFrameRef::release()': sensorOpenNI.cpp:(.text._ZN6openni13VideoFrameRef7releaseEv[openni::VideoFrameRef::release()]+0x18): undefined reference to
oniFrameRelease'中 /tmp/ccrPQHEg.o:在函数openni::VideoFrameRef::_setFrame(OniFrame*)': sensorOpenNI.cpp:(.text._ZN6openni13VideoFrameRef9_setFrameEP8OniFrame[openni::VideoFrameRef::_setFrame(OniFrame*)]+0x25): undefined reference to
oniFrameAddRef'中 /tmp/ccrPQHEg.o:在函数nite::UserTrackerFrameRef::release()': sensorOpenNI.cpp:(.text._ZN4nite19UserTrackerFrameRef7releaseEv[nite::UserTrackerFrameRef::release()]+0x24): undefined reference to
niteUserTrackerFrameRelease'中 /tmp/ccrPQHEg.o:在函数nite::UserTracker::create(openni::Device*)': sensorOpenNI.cpp:(.text._ZN4nite11UserTracker6createEPN6openni6DeviceE[nite::UserTracker::create(openni::Device*)]+0x13): undefined reference to
niteInitializeUserTracker'中 sensorOpenNI.cpp :(。text._ZN4nite11UserTracker6createEPN6openni6DeviceE [nite :: UserTracker :: create(openni :: Device *)] + 0x27):对niteInitializeUserTrackerByDevice' /tmp/ccrPQHEg.o: In function
nite :: UserTracker :: destroy()'的未定义引用: sensorOpenNI.cpp :(。text._ZN4nite11UserTracker7destroyEv [nite :: UserTracker :: destroy()] + 0x1e):对niteShutdownUserTracker' /tmp/ccrPQHEg.o: In function
nite :: UserTracker :: readFrame(nite :: UserTrackerFrameRef *)'的未定义引用: sensorOpenNI.cpp :(。text._ZN4nite11UserTracker9readFrameEPNS_19UserTrackerFrameRefE [nite :: UserTracker :: readFrame(nite :: UserTrackerFrameRef *)] + 0x1d):对niteReadUserTrackerFrame' /tmp/ccrPQHEg.o: In function
nite :: UserTracker :: startSkeletonTracking(short)'的未定义引用: sensorOpenNI.cpp :(。text._ZN4nite11UserTracker21startSkeletonTrackingEs [nite :: UserTracker :: startSkeletonTracking(short)] + 0x1e):对niteStartSkeletonTracking' /tmp/ccrPQHEg.o: In function
nite :: NiTE :: initialize()'的未定义引用: sensorOpenNI.cpp :(。text._ZN4nite4NiTE10initializeEv [nite :: NiTE :: initialize()] + 0x7):对niteInitialize' collect2: ld returned 1 exit status patrick@ubuntu:~/Koerpersteuerung$ g++ -c sensorOpenNI.cpp sensorOpenNI.hpp -I Include/ patrick@ubuntu:~/Koerpersteuerung$ g++ mainSensor.cpp sensorOpenNI.o -I Include/ sensorOpenNI.o: In function
openni :: VideoFrameRef :: release()'的未定义引用: sensorOpenNI.cpp :(。text._ZN6openni13VideoFrameRef7releaseEv [openni :: VideoFrameRef :: release()] + 0x18):对oniFrameRelease' sensorOpenNI.o: In function
openni :: VideoFrameRef :: _ setFrame(OniFrame *)'的未定义引用: sensorOpenNI.cpp :(。text._ZN6openni13VideoFrameRef9_setFrameEP8OniFrame [openni :: VideoFrameRef :: _ setFrame(OniFrame *)] + 0x25):对oniFrameAddRef' sensorOpenNI.o: In function
nite :: UserTrackerFrameRef :: release()'的未定义引用: sensorOpenNI.cpp :(。text._ZN4nite19UserTrackerFrameRef7releaseEv [nite :: UserTrackerFrameRef :: release()] + 0x24):对niteUserTrackerFrameRelease' sensorOpenNI.o: In function
nite :: UserTracker :: create(openni :: Device *)'的未定义引用: sensorOpenNI.cpp :(。text._ZN4nite11UserTracker6createEPN6openni6DeviceE [nite :: UserTracker :: create(openni :: Device *)] + 0x13):对niteInitializeUserTracker' sensorOpenNI.cpp:(.text._ZN4nite11UserTracker6createEPN6openni6DeviceE[nite::UserTracker::create(openni::Device*)]+0x27): undefined reference to
niteInitializeUserTrackerByDevice'的未定义引用 sensorOpenNI.o:在函数nite::UserTracker::destroy()': sensorOpenNI.cpp:(.text._ZN4nite11UserTracker7destroyEv[nite::UserTracker::destroy()]+0x1e): undefined reference to
niteShutdownUserTracker'中 sensorOpenNI.o:在函数nite::UserTracker::readFrame(nite::UserTrackerFrameRef*)': sensorOpenNI.cpp:(.text._ZN4nite11UserTracker9readFrameEPNS_19UserTrackerFrameRefE[nite::UserTracker::readFrame(nite::UserTrackerFrameRef*)]+0x1d): undefined reference to
niteReadUserTrackerFrame中 sensorOpenNI.o:在函数nite::UserTracker::startSkeletonTracking(short)': sensorOpenNI.cpp:(.text._ZN4nite11UserTracker21startSkeletonTrackingEs[nite::UserTracker::startSkeletonTracking(short)]+0x1e): undefined reference to
niteStartSkeletonTracking中 sensorOpenNI.o:在函数nite::NiTE::initialize()': sensorOpenNI.cpp:(.text._ZN4nite4NiTE10initializeEv[nite::NiTE::initialize()]+0x7): undefined reference to
niteInitialize'中 collect2:ld返回1退出状态
我这样称为g ++:
g++ -o test mainSensor.cpp sensorOpenNI.cpp -I Include/
答案 0 :(得分:0)
尝试复制libOpenNI2.so和libNiTE2这样的库:
sudo cp ./OpenNI-Linux-x86-2.2/Redist/libOpenNI2.so /usr/local/lib
sudo cp ./NiTE-Linux-x86-2.2/Redist/libNiTE2.so /usr/local/lib
然后呢
sudo ldconfig
现在通过添加-lOpenNI2 -lNiTE2 来编译程序