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>
  • 相关阅读:
    hive基本操作与应用
    理解MapReduce计算构架
    熟悉HBase基本操作
    熟悉常用的HDFS操作
    爬虫大作业
    数据结构化与保存
    使用正则表达式,取得点击次数,函数抽离
    爬取校园新闻首页的新闻
    网络爬虫基础练习
    Hadoop综合大作业
  • 原文地址:https://www.cnblogs.com/zhchoutai/p/7020093.html
Copyright © 2011-2022 走看看