在Linux上安装Qt,找不到-lGL [英] Installing Qt on linux, cannot find -lGL

查看:733
本文介绍了在Linux上安装Qt,找不到-lGL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难在Linux上安装Qt.我在网站上下载了.run文件并安装了Qt.但是,当我尝试使用Qtcreator编译默认的Hello World项目时,得到以下信息:

I'm having a hard time trying to install Qt on linux. I downloaded the .run file on the website and installed Qt. However, when I try to compile the default Hello World project using Qtcreator, I get the following :

error cannot find -lGL

我能够通过发出以下命令解决问题:

I was able to solve the problem by issuing the command :

sudo apt-get install libqt4-dev

但是,我对解决方案不满意,因为我想使用Qt5,我下载的lib的名称暗示了版本4.有人可以解释发生了什么并告诉我我的解决方案是否正确吗?如果没有,我应该怎么做才能在Linux上运行Qt.

But, I'm not satisfied with the solution as I want to use Qt5 and the name of the lib I downloaded implies version 4. Can someone explain what is going on and tell me if my solution is correct? If not, what should I do to get a working Qt on Linux.

其他问题

LemWorf 提供的正确答案是安装 libgl-dev .对于将来出现的此类问题,有人可以告诉我我应该如何猜测自己必须下载此特定库?为什么最后会有一些带有 -dev 的库?他们提供什么?

The correct answer, as provided by LtWorf, was to install libgl-dev. For future problems of this sort, can someone tell me how I should have guessed that I had to download this particular library? And why are there some libs with -dev at the end? What do they provide?

推荐答案

好,它正在尝试与libgl链接,但未找到它.您应该安装 libgl-dev .

Well it is trying to link with libgl and doesn't find it. You should install libgl-dev.

-l是链接器选项,它告诉链接器使用某个库. 例如,您可以具有-lmagic的含义,即您想使用 libmagic .

-l is a linker option, it tells the linker to use a certain library. For example you can have -lmagic meaning that you want to use libmagic.

通常所有库都称为libsomething,在debian上,您会发现3个软件包: 淫荡的东西 libsomething-dbg libsomething-dev

Normally all libraries are called libsomething, and on debian you will find 3 packages called: libsomething libsomething-dbg libsomething-dev

第一个是库,第二个是使用调试符号编译的库,因此您可以更轻松地理解堆栈跟踪,最后一个是开发包,它包含.h文件,因此您可以链接到库.

The 1st one is the library, the second one is the library compiled with the debug symbols, so you can make sense of stacktraces more easily, and the final one is the development package, it contains the .h files so you can link to the library.

这篇关于在Linux上安装Qt,找不到-lGL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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