简体   繁体   English

链接错误-Qt和VS2013上的Oculus Rift Libs(Linux-Windows)

[英]Linking error - Oculus Rift Libs on Qt and VS2013 (Linux - Windows)

I am stack on this error since a week and I don't have any solutions ... 一个星期以来我一直在解决这个错误,我没有任何解决方案...

Linux - Qt Creator 5.2 Linux-Qt Creator 5.2

I am trying to make program on Qt which uses the Oculus Rift libs but despite all the possibilities to link a library on Qt creator, I always find the same error unfortunately. 我正在尝试在使用Oculus Rift库的Qt上编写程序,但是尽管有所有可能链接Qt Creator上的库,但不幸的是,我总是发现相同的错误。

I have tried 3 different ways to implement it as you can see here : 我尝试了3种不同的方法来实现它,如您在此处看到的:

- Direct link to the path (Way 2) - 直接链接到路径 (方法2)

- Compile the library in static with QtCreator and link the output to my project (Way 1) - 使用QtCreator静态编译库并将输出链接到我的项目 (方法1)

- Qt Creator -> Project (right click) -> Add Library -> Path to the Lib (Way 3) -Qt Creator->项目(右键单击)->添加库->库的路径 (方法3)

This is my .pro file 这是我的.pro文件

QT       += core
QT       -= gui
TARGET = TestOVR3
CONFIG   += console
CONFIG   -= app_bundle
CONFIG += link_pkgconfig
PKGCONFIG += opencv
PKGCONFIG += x11
TEMPLATE = app

# Input Include
INCLUDEPATH += /home/why/Documents/OculusSDK/LibOVR/Include/

# Input Lib - Way 1
#LIBS+=  -L /home/why/Documents/Test/OVRLib/build-OVRLib-Desktop-Debug -lOVRLib

# Input Lib - Way 2
LIBS += -L /home/why/Documents/OculusSDK/LibOVR/Lib/Linux/Debug/x86_64/libovr.a

SOURCES += main.cpp

HEADERS += \
    Headers.h

# Input Lib - Way 3
#unix:!macx: LIBS += -L$$PWD/../../OculusSDK/LibOVR/Lib/Linux/Debug/x86_64/ -lovr

#INCLUDEPATH += $$PWD/../../OculusSDK/LibOVR/Lib/Linux/Debug/x86_64
#DEPENDPATH += $$PWD/../../OculusSDK/LibOVR/Lib/Linux/Debug/x86_64

#unix:!macx: PRE_TARGETDEPS += $$PWD/../../OculusSDK/LibOVR/Lib/Linux/Debug/x86_64/libovr.a

Error 错误

I didn't copy past everything but it gives you an idea. 我并没有复制所有内容,但是它给了您一个主意。 The main file is composed of a basic tutorial from a tutorial available at : https://developer.oculusvr.com/ 主文件由以下基础教程组成: https : //developer.oculusvr.com/

main.o: In function `Clear()':

/home/why/Documents/Test/build-TestOVR3-Desktop-Debug/../TestOVR3/main.cpp:49: undefined reference to OVR::SensorFusion::~SensorFusion()' /home/why/Documents/Test/build-TestOVR3-Desktop-Debug/../TestOVR3/main.cpp:51: undefined reference to OVR::System::Destroy()' main.o: In function OVR::Allocator::GetInstance()': /home/why/Documents/Test/build-TestOVR3-Desktop-Debug/../../OculusSDK/LibOVR/Include/../Src/Kernel/OVR_Allocator.h:216: undefined reference to OVR::Allocator::pInstance' main.o: In function `OVR::Log::ConfigureDefaultLog(unsigned int)': /home/why/Documents/Test/build-TestOVR3-Desktop-Debug/../../OculusSDK/LibOVR/Include/../Src/Kernel/OVR_Log.h:159: undefined reference to /home/why/Documents/Test/build-TestOVR3-Desktop-Debug/../TestOVR3/main.cpp:49:对OVR::SensorFusion::~SensorFusion()' /home/why/Documents/Test/build-TestOVR3-Desktop-Debug/../TestOVR3/main.cpp:51: undefined reference to未定义引用OVR::SensorFusion::~SensorFusion()' /home/why/Documents/Test/build-TestOVR3-Desktop-Debug/../TestOVR3/main.cpp:51: undefined reference to OVR :: System :: Destroy()'main.o的OVR::SensorFusion::~SensorFusion()' /home/why/Documents/Test/build-TestOVR3-Desktop-Debug/../TestOVR3/main.cpp:51: undefined reference to :在函数OVR::Allocator::GetInstance()': /home/why/Documents/Test/build-TestOVR3-Desktop-Debug/../../OculusSDK/LibOVR/Include/../Src/Kernel/OVR_Allocator.h:216: undefined reference to OVR :: Allocator的OVR::Allocator::GetInstance()': /home/why/Documents/Test/build-TestOVR3-Desktop-Debug/../../OculusSDK/LibOVR/Include/../Src/Kernel/OVR_Allocator.h:216: undefined reference to : :pInstance'main.o:在函数'OVR :: Log :: ConfigureDefaultLog(unsigned int)'中:/home/why/Documents/Test/build-TestOVR3-Desktop-Debug/../../OculusSDK/LibOVR/ include /../ Src / Kernel / OVR_Log.h:159:未定义的引用

Anyone has an idea ? 有人有主意吗? :S :S

Visual studio 2013 & Qt Add-in VS2013 Visual Studio 2013和Qt加载项VS2013

Exactly the same errors :S 完全一样的错误:S

I believe that your issue stems from the line 我相信您的问题源于

LIBS += -L /home/why/Documents/OculusSDK/LibOVR/Lib/Linux/Debug/x86_64/libovr.a

The -L (capital) option specifies the directory in which to search for libraries. -L(大写)选项指定要在其中搜索库的目录。 You need to specify the directory to look for libovr.a, not the static library itself. 您需要指定目录以查找libovr.a,而不是静态库本身。 Then afterwards you would add a -l option, in this case -lovr to specify the library to use. 然后,您将添加-l选项,在本例中为-lovr以指定要使用的库。

So basically you need to change that line to 所以基本上您需要将该行更改为

LIBS += -L /home/why/Documents/OculusSDK/LibOVR/Lib/Linux/Debug/x86_64/

and then add somewhere (Because I'm not familiar with the format of makefiles) 然后添加到某处(因为我不熟悉makefile的格式)

-lovr

It might be a bit late, but I just had this problem yesterday and I figured I'd post. 可能有点晚了,但是昨天我刚遇到这个问题,所以我想过要发布。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM