Nominate our 2022 Qt Champions!

How to run OpenGL examples with M Visual studio 2013 as IDE.

  • Hello,
    I'am new with Qt. there is only some months, i started to use Qt and its ok.
    Now , i wanted to start with openGL in Qt. I can run easly the opengl examples when i use qtCreator but i can't with visual studio 2013 as IDE.

    Is there anything else needed in MVS2013 to run openGL example?
    I use Qt 5.3.2 and Win 7.
    any help?? Thank you.

  • Lifetime Qt Champion


    AFAIK no, there's nothing special needed. What errors are you getting ?

  • Hi,
    I had created a new Qt project, then i added the file given in "Hello gl" example, except the .pro file.

    an error of a qtlogo file missed was displayed , then i imported olso qtlogo found in Shared folder.

    the folowing error appears now:

    error C1083: Cannot open source file: 'GeneratedFiles\Debug\moc_glwidget.cpp'.

    As i am new with that, i just want to be sure that there is no other extension i have to install in order to use opengl with visual studio.


  • Here is the solution to generate moc_glwidget.cpp:

    right click on the header file in solution explorer and select properties.
    In the properties dialog select under Item Type, custom build tool.
    Then in the command line part, you put this line:

    moc -o moc_glwidget.cpp glwidget.h

    I think my visual studio is working well with OpenGL, i will continue with more exercises.

    Thanks you for your help.

Log in to reply