gpt4 book ai didi

c++ - 在 MacOSX 上编译 OpenGL 程序时出错 ('ld: library not found for -lopengl32' )

转载 作者:行者123 更新时间:2023-11-30 04:48:31 24 4
gpt4 key购买 nike

当我尝试在 MacOSX 上使用 OpenGL 编译程序时,我收到错误消息“ld: library not found for -lopengl32”和“clang: error: linker command failed with exit code 1(使用 -v 查看调用) ',我猜这是由于找不到库造成的。该代码适用于 Windows,但不适用于 Mac。我正在使用 CodeBlocks 13.12。

我尝试使用命令安装 OpenGL

brew install glfw3

brew install glew

但我仍然得到同样的错误。

我已经在 Windows 系统上试过了,它开箱即用。

我需要做什么来安装缺少的库?

最佳答案

opengl32Windows 上 API 库的名称。在 macOS 上,您必须使用 -framework OpenGL 而不是 -lopengl32。作为引用,在 Linux 上它是 -lGL(链接到传统的 LSB 定义的 libGL.so)或 -lOpenGL(链接到 GLVND) .

关于c++ - 在 MacOSX 上编译 OpenGL 程序时出错 ('ld: library not found for -lopengl32' ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55771792/

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