far and near break code? (was "syntax error before -semicolon here- token"?)

Started by
16 comments, last by mike25025 19 years, 1 month ago
im gitting a "syntax error before `;' token" error in this code but i cant see anything wrong with it
virtual void perspective(ml::f32 fov,ml::f32 aspect,ml::f32 near,
	ml::f32 far){
	select();
	gluPerspective(fov,aspect,near,far); // << error
}
can anyone see something wrong with it? [Edited by - mike25025 on March 7, 2005 12:14:46 AM]
Advertisement
This compiles and links fine on my system:

#include <GL/glu.h>namespace ml{        typedef float f32;}struct a{        void select( void )        {        }        virtual void perspective( ml::f32 fov , ml::f32 aspect , ml::f32 near , ml::f32 far )        {                select();                gluPerspective( fov , aspect , near , far );        }};int main ( int argc , char ** argv ){}


Meaning: the compiler gets confused before that bit.
if i comment out that line the error goes away so is the error in the gl headers? (i dont think this is the problem)
or is my code breaking that command?

what should i do to fix this?
Note that most any network enabled code will include a seperate function select() which takes 5 params, not 0. Might not be the problem, but...
Quote:Original post by mike25025
if i comment out that line the error goes away so is the error in the gl headers? (i dont think this is the problem)
or is my code breaking that command?

what should i do to fix this?


Is the code copied and pasted? Usually I get this kind of message in this kind of situtation when I missed a curly brace or the like on the previous function. It really goes away when you comment out the line? Or is it replaced by a new error?
the error goes away and the file compiles when i comment out the glPerspective line

this is very strange
i cant find any typos anywhere in my code
If you're dead sure there are no typos, you might want to look for dodgy #define's replacing what would otherwise be valid code.
Quote:Original post by glassJAw
If you're dead sure there are no typos, you might want to look for dodgy #define's replacing what would otherwise be valid code.

just did that
didnt find any
I would check your includes. That sort of errors usually results from one of the identifiers on that line or one above it being undefined. Since MaulingMonkey compiled it successfully, I would guess the problem has something to do with gluPerspective(). Do you include the same include file as MaulingMonkey?
Quote:Original post by mumpo
Do you include the same include file as MaulingMonkey?

yep
first thing i checked

edit: if i remove the semicolon from that line the error is still there
this is very strange

This topic is closed to new replies.

Advertisement