c++ - 如何构建 OpenGL + GLEW + GLFW 程序,以便在带有 exe 的文件夹中不需要 glfw3.dll?

标签 c++ opengl codeblocks glew glfw

我编译并执行了一个从教程中复制的简单 OpenGL + GLEW + GLFW 程序。我在 Win 7 x64 机器上使用了 C++ 和 CodeBlocks 13.12。

仅当 exe 所在的 bin/Debug 文件夹中存在 glfw3.dll 文件时,程序才会执行。否则会报错:程序无法执行,因为在系统中找不到glfw.dll。我使用了默认的 CodeBlocks 设置。

我如何构建程序,以便在包含 exe 文件的文件夹中不需要 glfw3.dll,而是将其内置到程序中?

最佳答案

Statically link GLFW :

The static version of the GLFW library is named glfw3. When using this version, it is also necessary to link with some libraries that GLFW uses.

When linking a program under Windows that uses the static version of GLFW, you must link with opengl32. If you are using GLU, you must also link with glu32.

关于c++ - 如何构建 OpenGL + GLEW + GLFW 程序,以便在带有 exe 的文件夹中不需要 glfw3.dll?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22846707/

相关文章:

codeblocks - 如何在代码块中配置msys2?

Codeblocks vs GCC 不同的输出(奇怪的行为)?

c++ - 找出QPlainTextEdit删除的文本

c++ - 专门的模板是否需要专门的声明?

opengl - GLSL 中的顶点着色器属性映射

c++ - 垂直翻转Char数组: is there a more efficient way?

c++ - 如果在共享内存中,pthread 互斥锁是否可以跨线程工作?

c++ - 使用 boost::filesystem 时如何正确处理错误?

c - 使用 GLUT 和 C 的闪烁 2D 纹理

c++程序无法在另一台PC上运行并出现libgcc错误