小编Cal*_*ner的帖子

用变量进行C结构初始化

我遇到了C89之后似乎没有通过任何C标准解决的问题,除非提到结构初始化限制已被解除.但是,我使用Open Watcom IDE(用于调试)遇到错误,其中编译器声明初始化程序必须是常量表达式.

这是正在发生的事情的要点.

typedef struct{
 short x;
 short y;

} POINT;

void foo( short x, short y )
{
 POINT here = { x, y }; /* <-- This is generating the error for the compiler */

 /* ... */

}
Run Code Online (Sandbox Code Playgroud)

任何想法为什么,或什么标准不允许?

c variables structure initialization

3
推荐指数
1
解决办法
5297
查看次数

使用minGW gcc对_imp ____ glew*函数进行未定义的引用

我试图在Win 7 x64系统上使用MinGW编译一个相对简单的OpenGL程序,并且我不断获得对几个GLEW函数的未定义引用.我已将库设置为链接到程序,并且一直在寻找我列表中可能缺少的任何库,但链接器的输出仍然如下所示:

16:35:50 **** Incremental Build of configuration Debug for project test ****
Info: Internal Builder is used for build
gcc -LD:/DEV/openGL/lib/x86 -LD:/DEV/x86/lib -o test.exe test.o -lfreeglut -lglaux -lglew32s -lglu32 -lglfw3 -lopengl32 -lgdi32 
test.o: In function `init':
E:\Development\C\test\Debug/../test.c:32: undefined reference to `_imp____glewGenVertexArrays'
E:\Development\C\test\Debug/../test.c:33: undefined reference to `_imp____glewBindVertexArray'
E:\Development\C\test\Debug/../test.c:35: undefined reference to `_imp____glewGenBuffers'
E:\Development\C\test\Debug/../test.c:36: undefined reference to `_imp____glewBindBuffer'
E:\Development\C\test\Debug/../test.c:37: undefined reference to `_imp____glewBufferData'
test.o: In function `display':
E:\Development\C\test\Debug/../test.c:45: undefined reference to  `_imp____glewBindVertexArray'
test.o: In function `main':
E:\Development\C\test\Debug/../test.c:61: undefined reference to …
Run Code Online (Sandbox Code Playgroud)

c windows opengl mingw undefined-reference

2
推荐指数
1
解决办法
9306
查看次数