User forums > General (but related to Code::Blocks)

Strange Behaviour

<< < (2/5) > >>

thomas:

--- Code: ---#include <gl/gl.h>

int main()
{
GLfloat f = 0.0;
return 0;
};
--- End code ---
compiles without errors using revision 2002. No Code::Blocks bug.

BTW, having that #pragma directive in a source file is not good, although that is very likely not the cause of the problem. If you compile with -Wall, the compiler will probably complain about that.

There are many possible causes why you see that error. One such cause may be that you have a bad GL/gl.h file somewhere in your include path by accident (which is then included).

kkez:

--- Quote from: Cybrid on February 14, 2006, 10:40:51 pm ---Yes, I've tried to add the headers directly and it didn't work. Responding to your question (I may be wrong) GLfloat is defined in gl.h .

--- End quote ---
Well, open that file and search for GLfloat! Maybe it's between some #define/#endif (i'm used with that on winapi applications, maybe it's your case too)

Cybrid:
Trying to respond all of your questions:

This is the build log after enabling -Wall in Global compiler options.

Switching to target: default
Compiling: glScene.cpp
Compiling: main.cpp
In file included from main.cpp:4:
glInit.cpp: In member function `void glInit::changeSize(GLsizei, GLsizei)':
glInit.cpp:25: error: `GLfoat' undeclared (first use this function)
glInit.cpp:25: error: (Each undeclared identifier is reported only once for each function it appears in.)
glInit.cpp:25: error: expected `;' before "height"
main.cpp: In function `LRESULT WndProc(HWND__*, UINT, WPARAM, LPARAM)':
main.cpp:80: error: conversion from `glInit*' to non-scalar type `glInit' requested
Process terminated with status 1 (0 minutes, 1 seconds)
4 errors, 0 warnings

Checked, that "GLfloat" is defined in gl.h and it's not between #define/#endif. And the gl.h file is the one that came with C::B install.

P.S.: I can send all the proyect via e-mail if anyone wants it ;)

Michael:
Hello,

May be you have to put an include path(es) in the Directories-->Compiler. Did you check that?

Best wishes,
Michael

thomas:
Err... lol?

--- Quote ---glInit.cpp:25: error: `GLfoat' undeclared (first use this function)
--- End quote ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version