我正在尝试编译以下给出的非常基本的程序(test.cpp),该程序调用OpenNI类。您可以在此处查看文件和目录。抱歉,某些字符会破坏浏览器的编码。我正在使用linux命令:tree,如果您知道更好的命令,请告诉我,我将对其进行更新。

File Structure

我正在遵循here指南,请参阅“GCC / GNU Make”。

#include < stdio.h >
#include < OpenNI.h >

using namespace openni;

int
main ( void )
{
    Status rc = OpenNI::initialize();

    if (rc != STATUS_OK)
    {
        printf("\nInitialize failed\n%s\n", OpenNI::getExtendedError());
        return 1;
    }

    printf("Hello, world!\n");
    return 0;
}

这是我在命令行中运行的程序,用于对其进行编译(gcc 4.7.2):
gcc test.cpp -I../OpenNI-2.0.0/Include -L/home/evan/Code/OpenNi/Init -l OpenNI2 -o test

这工作正常,但是当我运行./test时,出现以下错误:
Initialize failed
DeviceDriver: library handle is invalid for file libOniFile.so
Couldn't understand file 'libOniFile.so' as a device driver
DeviceDriver: library handle is invalid for file libPS1080.so
Couldn't understand file 'libPS1080.so' as a device driver
Found no valid drivers in './OpenNI2/Drivers'

谢谢,任何帮助将不胜感激。

最佳答案

导游说,



看来您确实有这个问题-它找不到某些库。尝试在编译字符串中添加适当的rpath(在您的情况下,似乎是/ home / evan / Code / OpenNi / Init / OpenNI2 / Drivers)。

10-08 08:21
查看更多