zoukankan      html  css  js  c++  java
  • Qt编译OpenGL程序遇到的问题

    软件版本号:
    Qt 4.8.5
    依照网上的例程(http://www.qiliang.net/old/nehe_qt/lesson01.html),跑了一下基于Qt Creator的OpenGL。因为上述例程的Qt版本号较老(例程是02年的,汗。),在新的Qt环境下产生诸多问题,好在一一得到了解决,现说明例如以下:

    1、须要在project文件.pro中加入对OpenGL的支持:
    QT += opengl(记得清理项目后再编译!)
    否则会出现一大堆类似error: undefined reference to `glShadeModel@4'、error: undefined reference to `glClearColor@16'的问题。


    2、对于设置窗体Title的函数setCaption:
    [error: 'setCaption' was not declared in this scope]
    在新版本号中已经废弃。改而用setWindowTitle()函数取代:
    setCaption("Qt Open-GL");——>setWindowTitle("Qt Open-GL");

    3、对于glu开头的函数,如gluPerspective():
    [error: 'gluPerspective' was not declared in this scope]
    须要包括头文件
    #include <GL/glu.h> 

    4、用到QKeyEvent,须要包括其头文件
    [error: invalid use of incomplete type 'struct QKeyEvent']
    #include <QKeyEvent>
  • 相关阅读:
    (转载)Bonding技术指南
    Linux配置虚拟地址
    VB6之写注册表
    Tomcat集群搭建
    VBS连接远程Oracle
    机器学习 目标函数,损失函数
    深度学习理解内容 初
    leetcode 39. Combination Sum
    leetcode 33. Search in Rotated Sorted Array
    leetcode 29. Divide Two Integers
  • 原文地址:https://www.cnblogs.com/zhchoutai/p/7020093.html
Copyright © 2011-2022 走看看