未定义引用符号'XF86VidModeQueryExtension'(linux,qt creator IDE) [英] undefined reference to symbol 'XF86VidModeQueryExtension' (linux, qt creator IDE)

查看:711
本文介绍了未定义引用符号'XF86VidModeQueryExtension'(linux,qt creator IDE)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图得到一些简单的GL代码实现GFLW3在QT Creator(在Ubuntu 13.04上)编译。但是,当我尝试构建时,我仍然得到相同的输出:

I've been trying to get some simple GL code that implements GFLW3 to compile on QT Creator (on Ubuntu 13.04). However I keep getting the same output when it tries building:

undefined reference to symbol 'XF86VidModeQueryExtension'

然后我去了.pro文件并链接了lXxf86vm.so库文件并添加了-lXxf86vm,但它仍然提供相同的输出:

I then went to the .pro file and linked the lXxf86vm.so library file and added -lXxf86vm but it still gives the same output:

g++ -m64 -o GL-Test main.o windowtest.o frametest.o   -L/usr/lib/x86_64-linux-gnu/libXxf86vm.so.1 -L/user/lib/x86_64-linux-gnu/libXxf86vm.so 
-L/user/lib/x86_64-linux-gnu/libXxf86vm.a -L/user/lib/x86_64-linux-gnu/libXxf86vm.so.1.0.0 
-L/home/syk435/Testing\ Gl/GL-Test/../../../../usr/lib/x86_64-linux-gnu/ -lXxf86vm -lX11 -lGL -L/usr/local/lib -lglfw3 
/usr/bin/ld: /usr/local/lib/libglfw3.a(x11_init.c.o): undefined reference to symbol 'XF86VidModeQueryExtension'
/usr/bin/ld: note: 'XF86VidModeQueryExtension' is defined in DSO /home/syk435/Testing Gl/GL-Test/../../../../usr/lib/x86_64-linux-gnu//libXxf86vm.so 
so try adding it to the linker command line
/home/syk435/Testing Gl/GL-Test/../../../../usr/lib/x86_64-linux-gnu//libXxf86vm.so:
could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status

你可以看到,我试过四种不同的方式来链接正确的lib,但它仍然给我相同的未定义参考和符号无法读取错误。关于正确链接方式的任何洞察?

as you can see, I've tried four different ways to link the correct lib but it's still giving me the same "undefined reference" and "symbols could not be read" errors. Any insight on the proper way to link?

编辑:Pro文件:TEMPLATE = app

Pro file: TEMPLATE = app

CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt

CONFIG += link_pkgconfig
PKGCONFIG += x11

CONFIG += link_pkgconfig
PKGCONFIG += gl

CONFIG += link_pkgconfig
PKGCONFIG += glfw3

LIBS += -lXxf86vm -L/usr/lib/x86_64-linux-gnu/libXxf86vm.so.1
LIBS += -lXxf86vm -L/user/lib/x86_64-linux-gnu/libXxf86vm.so
LIBS += -lXxf86vm -L/user/lib/x86_64-linux-gnu/libXxf86vm.a
LIBS += -lXxf86vm -L/user/lib/x86_64-linux-gnu/libXxf86vm.so.1.0.0


推荐答案

问题在这里:

LIBS += -lXxf86vm -L/usr/lib/x86_64-linux-gnu/libXxf86vm.so.1
LIBS += -lXxf86vm -L/user/lib/x86_64-linux-gnu/libXxf86vm.so
LIBS += -lXxf86vm -L/user/lib/x86_64-linux-gnu/libXxf86vm.a
LIBS += -lXxf86vm -L/user/lib/x86_64-linux-gnu/libXxf86vm.so.1.0.0

您正在使用 -L 选项带有文件名而不是路径!您应该将这四行更改为:

You are using the -L option with a file name rather than a path! You should change those four lines to:

LIBS += -lXxf86vm -L/user/lib/x86_64-linux-gnu/

其次,如果顺序很重要,你需要使用 LIBS glfw3,这样的东西:

Secondly, if the ordering matters, you would need to use LIBS for glfw3, too, something like this:

LIBS += -lglfw3 -lXxf86vm -L/user/lib/x86_64-linux-gnu/

不要忘记指定glfw3路径。这取决于你的设置。你可能试图交换你当前的PKGCONFIG和LIBS语句的顺序,但是如果你移动代码不是太多的未来证明。另外,如果你可以共享两个库之间的路径,我不会亲自使用PKGCONFIG,只是LIBS。

Do not forget to assign the glfw3 path as well if needed. That is depending on your setup. You could probably try to swap the order of your current PKGCONFIG and LIBS statements, but it is not that much future proof if you move code around. Also, if you can share the path between the two libraries, I would not personally use PKGCONFIG, just LIBS.

这篇关于未定义引用符号'XF86VidModeQueryExtension'(linux,qt creator IDE)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆