简体   繁体   English

将glew.lib链接为带有eclipse的静态库

[英]Link glew.lib as a static library with eclipse

I am a newbie in C++, I made many searches before I ask, I started OpenGL tutorial with C++ , I am using eclipse with GNU cross compiler, I know how to like static libraries with libXXX.a format then I want to use GLEW library, I have its source code and a precompiled version for windows which is libglew32.lib , if I use make to compile the source code I get an error which is 我是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 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 . 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

if I put the library in the libraries folder and add it to the linker as I do with other libraries I get errors in compiling the project like undefined reference to 'glewExperimental' or Invalid arguments 'Candidates are:void glfwMakeContextCurrent(*)' 如果我将库放在库文件夹中,然后像其他库一样将其添加到链接器中,则会在编译项目时出现错误,例如undefined reference to 'glewExperimental'Invalid arguments 'Candidates are:void glfwMakeContextCurrent(*)'

so I have 2 questions: 所以我有两个问题:

  1. how can I compile the source code correctly to a static library which I can use in eclipse. 如何将源代码正确编译为可在eclipse中使用的静态库。
  2. can I add .lib files to use with eclipse? 我可以添加.lib文件以与Eclipse一起使用吗? if yes, how can I do? 是,该怎么办?

我用gcc编译了它,然后用ar排列,最后得到了libglew.a

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM