Silencer lack in Mac OSX 10.9, IDE: QT creator

I tried to create an opengl program for the qt creator installed on my mac with osx 10.9. I received several warnings about drying functions regarding its obsolescence in osx10.9, an example error message:

'glutInit' is deprecated: first deprecated on OS X 10.9 [-Wdeprecated-declarations] glutInit (& argc, & argv); ^

I wonder if GLUT.h can no longer be used in osx10.9? According to some other reports, it says that as long as we change the "OS X Deployment Target" to OSX10.8, it will work. How to do it in qtcreator? Thanks!

+6
source share
1 answer

You can still use it in 10.9. They send you a pretty strong signal that they want you to stop, though ...

You can disable these warnings with the -Wno-deprecated-declarations parameter of the compiler.

There are also some difficulties, including the correct headers, if you are trying to use GL3 level functions, because for this you need to enable gl3.h , while glut.h includes gl.h , which causes additional complaints about possible conflicts, the building. Some hacky workaround I found for this is to prevent glut.h from enabling gl.h by defining header protection:

 #include <OpenGL/gl3.h> #define __gl_h_ #include <GLUT/glut.h> 

Then, to use GL3 + level functions, you need to specify what with the additional flag on glutInitDisplayMode() :

 glutInitDisplayMode(... | GLUT_3_2_CORE_PROFILE); 

It looks like it's time to start using GLFW. I never used GLUT for anything serious, but it was always very convenient for small demos / tests.

+10
source

Source: https://habr.com/ru/post/970500/


All Articles