Opengl 未定义的引用`glewInit@0';
我试图通过执行以下操作将Opengl 未定义的引用`glewInit@0';,opengl,linker,codeblocks,glew,Opengl,Linker,Codeblocks,Glew,我试图通过执行以下操作将glew链接到code::blocks中的我的项目: //1- copied all the header files(glew.h....) to C:\Program Files (x86)\CodeBlocks\MinGW\include and //the libs to C:\Program Files (x86)\CodeBlocks\MinGW\lib //2-added the libs to the compiler Build Options
glew
链接到code::blocks
中的我的项目:
//1- copied all the header files(glew.h....) to C:\Program Files (x86)\CodeBlocks\MinGW\include and
//the libs to C:\Program Files (x86)\CodeBlocks\MinGW\lib
//2-added the libs to the compiler Build Options > Linker Settings > add (considered to add glew32s.lib at the top)
|undefined reference to `glewInit@0'|
不知道我在这里遗漏了什么 看起来
.lib
文件没有正确添加到项目中
将glew32.lib
文件放在项目文件夹中和/或程序的.exe
文件将编译和导出到的位置,还请记住.lib
文件始终需要放在程序的文件夹中,尽管不是opengl32.lib
还要将此代码添加到main.cpp
文件的顶部
#pragma comment(lib, "opengl32.lib")
#pragma comment(lib, "glew32.lib")
老问题我知道,但有同样的问题,最后发现我的问题 我需要将“glew32s”链接到我的项目,并将其放在列表的第一位。 在代码::块中:
我假设你现在已经解决了或者放弃了,但这对我来说很有效。如果你有同样的问题,你的解决方案就不起作用了。我不知道lib文件必须和可执行文件在同一个目录中;以前从来没有必要这么做过。因为这是一个比较老的问题,@MixedCoder,你找到另一个解决方案了吗?