0

我用自己的 CMakeLists.txt 文件来构建 OpenNI 示例。我成功构建了 NiSimpleViewer。但是当尝试使用 NiUserTracker 我得到这个错误:

35 warnings generated.
Linking CXX executable main
ld: warning: path '/usr/lib/libOpenNI.dylib' following -L not a directory
Undefined symbols for architecture x86_64:
  "DrawDepthMap(xn::DepthMetaData const&, xn::SceneMetaData const&)", referenced from:
      glutDisplay() in main.cpp.o
  "MyPoseInProgress(xn::PoseDetectionCapability&, char const*, unsigned int, XnPoseDetectionStatus, void*)", referenced from:
      _main in main.cpp.o
  "MyCalibrationInProgress(xn::SkeletonCapability&, unsigned int, XnCalibrationStatus, void*)", referenced from:
      _main in main.cpp.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[2]: *** [main] Error 1
make[1]: *** [CMakeFiles/main.dir/all] Error 2
make: *** [all] Error 2

这是我使用的 CMakeLists。请告诉我它有什么问题?

http://pastebin.com/SMYjjU35

build/ 外部文件夹的内容是

CMakeLists.txt  Libs            build           opengles.cpp
GL              SceneDrawer.cpp glh             opengles.h
GLES            SceneDrawer.h   main.cpp
4

1 回答 1

0

我想,是因为这条线:

link_directories(${OPENNI_LIBRARY})

link_directories()命令设置应搜索库的路径,因此您需要类似的内容${OPENNI_LIBRARY_DIRS}

于 2012-10-07T13:25:59.840 回答