qt添加库freenect

时间:2016-10-04 10:57:49

标签: qt ubuntu libusb-1.0 libfreenect2

我在Ubuntu 16.04上安装了libfreenect。然后当我在Qt中添加它的库时,发生了以下错误。

我尝试添加libusb-1.0。我在终端输入了这个:

pkg-config libusb-1.0 --libs --cflags -I / usr / include / libusb-1.0 -lusb-1.0

  • .pro文件:

    QT + =核心 QT - = gui

    CONFIG + = c ++ 11

    TARGET = 1 CONFIG + = console CONFIG - = app_bundle

    TEMPLATE = app

    SOURCES + = main.cpp

    win32:CONFIG(release,debug | release):LIBS + = -L $$ PWD /../../../ usr / local / lib / release / -lfreenect_sync else:win32:CONFIG(debug,debug | release):LIBS + = -L $$ PWD /../../../ usr / local / lib / debug / -lfreenect_sync else:unix:LIBS + = -L $$ PWD /../../../ usr / local / lib / -lfreenect_sync

    INCLUDEPATH + = $$ PWD /../../../ usr / local / include DEPENDPATH + = $$ PWD /../../../ usr / local / include

    win32-g ++:CONFIG(release,debug | release):PRE_TARGETDEPS + = $$ PWD /../../../ usr / local / lib / release / libfreenect_sync.a else:win32-g ++:CONFIG(debug,debug | release):PRE_TARGETDEPS + = $$ PWD /../../../ usr / local / lib / debug / libfreenect_sync.a else:win32:!win32-g ++:CONFIG(release,debug | release):PRE_TARGETDEPS + = $$ PWD /../../../ usr / local / lib / release / freenect_sync.lib else:win32:!win32-g ++:CONFIG(debug,debug | release):PRE_TARGETDEPS + = $$ PWD /../../../ usr / local / lib / debug / freenect_sync.lib else:unix:PRE_TARGETDEPS + = $$ PWD /../../../ usr / local / lib / libfreenect_sync.a

    win32:CONFIG(release,debug | release):LIBS + = -L $$ PWD /../../../ usr / local / lib / release / -lfreenect_sync else:win32:CONFIG(debug,debug | release):LIBS + = -L $$ PWD /../../../ usr / local / lib / debug / -lfreenect_sync else:unix:LIBS + = -L $$ PWD /../../../ usr / local / lib / -lfreenect_sync

    INCLUDEPATH + = $$ PWD /../../../ usr / local / include DEPENDPATH + = $$ PWD /../../../ usr / local / include

    win32:CONFIG(发布,调试版|发布):LIBS + = -L $$ PWD /../../../ usr / local

    / lib / release / -lfreenect else:win32:CONFIG(debug,debug | release):LIBS + = -L $$ PWD /../../../ usr / local / lib / debug / -lfreenect else:unix:LIBS + = -L $$ PWD /../../../ usr / local / lib / -lfreenect

    INCLUDEPATH + = $$ PWD /../../../ usr / local / include DEPENDPATH + = $$ PWD /../../../ usr / local / include

    win32-g ++:CONFIG(release,debug | release):PRE_TARGETDEPS + = $$ PWD /../../../ usr / local / lib / release / libfreenect.a else:win32-g ++:CONFIG(debug,debug | release):PRE_TARGETDEPS + = $$ PWD /../../../ usr / local / lib / debug / libfreenect.a else:win32:!win32-g ++:CONFIG(release,debug | release):PRE_TARGETDEPS + = $$ PWD /../../../ usr / local / lib / release / freenect.lib else:win32:!win32-g ++:CONFIG(debug,debug | release):PRE_TARGETDEPS + = $$ PWD /../../../ usr / local / lib / debug / freenect.lib else:unix:PRE_TARGETDEPS + = $$ PWD /../../../ usr / local / lib / libfreenect.a

    win32:CONFIG(发布,调试|发布):LIBS + = -L $$ PWD /../../../ usr / local / lib / release / -lfreenect else:win32:CONFIG(debug,debug | release):LIBS + = -L $$ PWD /../../../ usr / local / lib / debug / -lfreenect else:unix:LIBS + = -L $$ PWD /../../../ usr / local / lib / -lfreenect

    INCLUDEPATH + = $$ PWD /../../../ usr / local / include DEPENDPATH + = $$ PWD /../../../ usr / local / include

    win32:CONFIG(发布,调试版|发布):LIBS + = -L $$ PWD /../../../ usr / lib / release / -lusb-1.0 else:win32:CONFIG(debug,debug | release):LIBS + = -L $$ PWD /../../../ usr / lib / debug / -lusb-1.0 else:unix:LIBS + = -L $$ PWD /../../../ usr / lib / -lusb-1.0

    INCLUDEPATH + = $$ PWD /../../../ usr / include DEPENDPATH + = $$ PWD /../../../ usr / include

但同样的错误也会发生。我该如何解决?

1 个答案:

答案 0 :(得分:0)

我认为错误信息是不言自明的。您没有安装lblTitle?.text = "This is \n title" 个开发包(即libusb-1.0.0)。

首先检查您是否安装了libusb-1.0.0-dev软件包(请注意,这是与libfreenect-dev不同的软件包)。如果已安装,您的libfreenect软件包可能已损坏,您应该重新安装它。如果未安装,则应安装libusb-1.0.0-dev包。

正在安装libfreenect-dev

libusb-1.0.0-dev

正在安装sudo apt-get install libusb-1.0.0-dev

libfreenect-dev

请注意,sudo apt-get install libfreenect-dev libusb-1.0.0-dev是两个不同的包,libusb-1.0.0libfreenect