Nominate our 2022 Qt Champions!

Setting OpenGl in plain C project

  • I am trying to set up OpenGl Project in QtCreator but as plain C project. I am using Qt application and its OpenGl capabilities normally but I wanted to try qtcreator as a C ide. So far I like it but I could not setup OpenGl. For some reason, I can't make it see glu.h.
    I am using MSVC 2012 kit on Windows and I wrote a quick just-open-window with SDL application. I was able to run it on Linux. Here is relevant portion of my .pro file regarding this;

    INCLUDEPATH += $$WINDOWSSDKDIR/../8.1/include/um/gl
    DEPENDPATH += $$WINDOWSSDKDIR/../8.1/include/um/gl

    Windows ships with glu.h in this directory. Also in my local include directory, I have GL folder that contains glew.h. This is how I always work with Visual Studio but Visual Studio just sees GL and glu since it's part of Windows SDK. What should I do to make this work on plain C project?

  • To solve this, I went to Projects -> Build Environment and added above paths to LIB and INCLUDE respectively. I thought writing them to .pro file would suffice.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Are you sure that WINDOWSSDKDIR is containing the right path ?

  • @SGaist $WINDOWSSDKDIR points to c:\Program Files x86\Windows Kits 8.0. I have two other folders here; 8.1 and 10 and gl headers are in 8.1. Thats why I added above includes. And I fixed the problem, adding those dirs to Build Environment by hand.

  • Lifetime Qt Champion

    What errors did you had ?

Log in to reply