【发布时间】:2017-09-17 01:43:49
【问题描述】:
我是 C++ 的新手,在我问之前我做了很多搜索,我开始使用 C++ 开始 OpenGL 教程,我正在使用带有 GNU 交叉编译器的 eclipse,我知道如何喜欢 libXXX.a 格式的静态库然后我想使用GLEW 库,我有它的源代码和Windows 的预编译版本libglew32.lib,如果我使用make 编译源代码,我会收到一个错误,即
make (e=2): The system cannot find the file specified.
Makefile:131: recipe for target 'tmp/cygwin/default/shared/glew.o' failed
make: *** [tmp/cygwin/default/shared/glew.o] Error 2.
如果我将库放在库文件夹中并将其添加到链接器中,就像处理其他库一样,我会在编译项目时遇到错误,例如 undefined reference to 'glewExperimental' 或 Invalid arguments 'Candidates are:void glfwMakeContextCurrent(*)'
所以我有 2 个问题:
- 如何将源代码正确编译成可以在 eclipse 中使用的静态库。
- 我可以添加
.lib文件以与eclipse 一起使用吗?如果是,我该怎么做?
【问题讨论】:
-
我使用 gcc 编译它并用 ar 衬里最后我得到了 libglew.a