【发布时间】:2010-11-09 01:13:04
【问题描述】:
我得到以下内容
x.cpp: In member function ‘X’:
x.cpp:153:10: warning: possible problem detected in invocation of delete operator:
x.cpp:146:19: warning: ‘quadric’ has incomplete type /usr/include/GL/glu.h:271:7: warning: forward declaration of ‘struct GLUquadric’
x.cpp:153:10: note: neither the destructor nor the class-specific operator delete will be called, even if they are declared when the class is defined.
使用此代码
146: GLUquadricObj * quadric;
147: quadric = gluNewQuadric();
148: gluQuadricNormals(quadric, GLU_SMOOTH);
149: gluQuadricTexture(quadric, GL_TRUE);
150:
151: gluSphere(quadric, object.radius(), slices, stacks);
152:
153: delete quadric;
我明白为什么会这样,GLUquadricObj 实际上是一个前向声明,但是
我想避免这个警告。
我想取消该唯一功能的警告。
或者通过包含正确的标题来解决警告。我在 /usr/include/GL 中使用了 grep 并没有找到完整的类型。
我正在使用 Arch Linux
台面 7.8.2-3
和
gcc 4.5.1-1
【问题讨论】:
标签: linux opengl gcc-warning