codeblock配置OpenGL

文章转载:感谢若之辰https://blog.csdn.net/sunny_xsc1994/article/details/44301841



1.2 一个补充
若是经过前面的配置仍然不行,也可以这么试试看。 在已存在的项目基础上右击 Project->Build Option ,在Linker Settings中add如下几个:

glut32
opengl32
glu32
winmm
gdi32
glaux

我当初就是一个程序配置好怎么都运行不起来,然后听了一个同学的建议,按照他的做法,add了上面几个,然后就ok了。偶也不知道他是从哪找到的这么一个方案。也不知道是否是凑巧,反正就先记下了吧。


1.3 遇到的两个很纠结的问题
苦逼地遇到两个问题,别的同学倒基本没遇到,偏偏我就都遇到了。。。编译就是通不过,纠结死了,后来按照下面的方法就搞定了。
No.1问题
某文件 undefined reference to '__某OpenGL函数名'

总之一大堆报红的错误。。。
这个问题在在CodeBlocks中使用openGL提到,可以参考它的做法,在包含OpenGL代码的include预编译指令前增加
#define _STDCALL_SUPPORTED 

就成功了,就是把这个写在你的代码的最开头。
No.2问题


error:redeclaration of C++ built-in type 'wchar_t' [-fpermissive]
会跳出个代码文本,里面有这么几行

用google搜了下,可以参考这个人的回答问题原因 

原文如下:
If wchart is already defined (to short for example), butthe
WCHARTDEFINED macro(宏) is not, the line will then be treated as:
typedef unsigned short short;

Which is a redeclaration of the built-in type. (don't use the .h btw, it's not used anymore per standard) is adding defines such that the typedef is not executed, or undef'ing wchar_t if it is a macro such that the typedef is legal.

解决方法就是,在代码的开头(#include前面)加上: 
#define _WCHAR_T_DEFINED

然后偶的问题就这么愉快地解决了
--------------------- 
作者:若之辰 
来源:CSDN 
原文:https://blog.csdn.net/sunny_xsc1994/article/details/44301841 
 

猜你喜欢

转载自blog.csdn.net/weixin_42785489/article/details/87910056
今日推荐