compilation problem
-
hi.
some time ago i started a project using an older version of Qt which i then put on ice. recently i decided to continue working on the project but now i have a problem: when i try to compile anything (even a brand new project with zero changes) i get the following error:error: GL/gl.h: No such file or directory
and it shows me the file where it says:
# include <GL/gl.h>
but that file is not one of mine. so what's going on here, and what can i do to solve this?
-
Which platform and compiler do you use? gl.h is normally provided by the compiler / platform sdk on windows or an additional opengl-devel package on linux.
-
can you give some more information please like what operating system are you using, qt version and so on? I've had something like that on my GNU/Linux and all I've done was to install de opengl-dev
-
@harry747 said in compilation problem:
sudo apt-get
do
sudo apt-cache search glut
and install dev packages from there
like sudo apt-get install freeglut3-dev -
@harry747 See https://doc.qt.io/qt-5/linux.html
Dosudo apt-get install build-essential libgl1-mesa-dev
-
something folks don't think about: after installing any linux/mesa opengl packages it is a good idea to re-install your nvidia drivers if you have nvidia, especially if you are using the nvidia.com drivers. Their tarball overwrites some of the mesa files and unless you reinstall the nvidia driver, either you won't get acceleration, or opengl will just break.
-
@Kent-Dorfman
some of us (hope the great majority) rely on the free (as in freedom GNU - GPL) nouveau driver - which is compatible with mesa. I think that what Linus said to nVidia in his lecture at the conference is still a valid point even today.. so...
F...k you nVidia!!! - this is why I'm using GNU/Linux to be free!!! -
sudo apt-get install freeglut3-dev
i did that. but now i have another problem: as soon as i click the green triangle to build my project, i get a dialog box titled "custom executable". it says "could not find the executable. please specify one". so what "executable" is this about? where can i find this "executable"? i have loads of executables on my system, so how do i know which one i need to specify?
-
This post is deleted!
-
@harry747 said in compilation problem:
some time ago i started a project using an older version of Qt which i then put on ice. r
It's not just that you put your Qt project on hold, moreover it looks like you changed/upgraded your development environment in between :-)
-
@harry747 said in compilation problem:
so what "executable" is this about?
The executable of your application which is generated when it is built. Do the following:
- Delete build directory
- Execute make
- Build
Does it work then?
If not, please post your pro file. -
so what "executable" is this about?
The executable of your application which is generated when it is built.
but then why does this also happen with a brand new project? in that case i can't select a executable because it doesn't exist yet.
Do the following:
- Delete build directory
done that.
- Execute make
how do i do that? i found a menu item "run qmake". is that what you mean?
- Build
Does it work then?
i deleted the build directory, then ran qmake from th menu (see above) and when i tried to build, it still asked me for a "custom executable" :-(
If not, please post your pro file.
here it is:
#------------------------------------------------- # # Project created by QtCreator 2017-02-05T10:37:55 # #------------------------------------------------- QT += widgets gui core TARGET = LCARSlib TEMPLATE = lib DEFINES += LCARSLIB_LIBRARY # The following define makes your compiler emit warnings if you use # any feature of Qt which as been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += lcarslib.cpp \ lcarsbutton.cpp \ lcarsuielement.cpp \ lcarsprefs.cpp \ lcarsscreen.cpp HEADERS += lcarslib.h\ lcarslib_global.h \ lcarsbutton.h \ lcarsuielement.h \ lcarsprefs.h \ lcarsscreen.h unix { target.path = /usr/lib INSTALLS += target }
[Edit aha_1980: added code tags]
-
what you have there it's a lib and not a program so how do you intend to use the lib?? you should make a small program to test your lib... lib is a library under GNU/Linux or a dll (dynamic link library) in windows
-
@harry747 said in compilation problem:
Execute make
how do i do that? i found a menu item "run qmake". is that what you mean?
Sorry, I mean qmake not make.
As @arsinte_andrei said your project is a library and not an executable - you can't execute a library. -
@jsulm
yeah, i know it's a library. but that doesn't explain why i can't compile it. so the question remains, what "custom executable" does this dialog box want me to select, and where can i find it?as for what i want to do with the library, i started writing an app for the purpose of testing the library, but the app couldn't find the library, which is why i put the whole thing on ice. but that's problem for another thread...
and here's a question about the forums: when i created my account here, i tried to use my main email address at protonmail.com, but the forum stubbornly refused to accept it, and i had to use my secondary address. WHY?
-
@harry747 said in compilation problem:
yeah, i know it's a library. but that doesn't explain why i can't compile it. so the question remains, what "custom executable" does this dialog box want me to select, and where can i find it?
If you cannot compile it, please post the actual compile errors.
The "custom executable" dialog appears when you press "Run" (the green triangle), and because you cannot run the library itself you should select the corresponding executable for that.
as for what i want to do with the library, i started writing an app for the purpose of testing the library, but the app couldn't find the library, which is why i put the whole thing on ice. but that's problem for another thread...
On which platform are you? On Windows, the lib has to be in the same directory as the exe file; on Linux that is not enough and the LD_LIBRARY_PATH has to be adjusted.
The best thing you can do is to put library and exe in a SUBDIRS project and adjust the .pro file of the exe so it finds the library automatically. Then you can build the whole project in one step.
Edit: an example of such a project can be found here: https://github.com/rainbyte/example-qmake-subdirs
Regards