gpt4 book ai didi

c++ - OpenGL Ubuntu 13.10 QtCreator - 未定义对 `glutMainLoop` 的引用

转载 作者:行者123 更新时间:2023-11-30 02:49:09 24 4
gpt4 key购买 nike

如果我尝试执行来自 here, the OpenGLBook 的代码,我收到此错误消息:

undefined reference to glutMainLoop
undefined reference to glGetString
undefined reference to glClearColor

等等...我安装了以下软件包:

libglew-devliblglew1.8freeglut3-devfreeglut3

我在 Ubuntu 13.10 上运行 Qt Creator v3.0.0。

我的 .pro 文件如下所示:

TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt

SOURCES += main.cpp

调试的构建步骤是qmake Project.pro -r -spec linux-g++ CONFIG += debug

如何修复我的项目?

最佳答案

必须将我的 pro 文件更改为

TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt

SOURCES += main.cpp

# this is the important part
unix|win32: LIBS += -lGLU
unix|win32: LIBS += -lGL
unix|win32: LIBS += -lglut

关于c++ - OpenGL Ubuntu 13.10 QtCreator - 未定义对 `glutMainLoop` 的引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21509367/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com