简体   繁体   中英

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

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.

I have tried 3 different ways to implement it as you can see here :

- Direct link to the path (Way 2)

- Compile the library in static with QtCreator and link the output to my project (Way 1)

- Qt Creator -> Project (right click) -> Add Library -> Path to the Lib (Way 3)

This is my .pro file

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/

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

Anyone has an idea ? :S

Visual studio 2013 & Qt Add-in VS2013

Exactly the same errors :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. You need to specify the directory to look for libovr.a, not the static library itself. Then afterwards you would add a -l option, in this case -lovr to specify the library to use.

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)

-lovr

It might be a bit late, but I just had this problem yesterday and I figured I'd post.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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