Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Strange syntax error

Reply
Thread Tools

Strange syntax error

 
 
Qu0ll
Guest
Posts: n/a
 
      04-25-2009
I am trying to compile the open source OGLFT library with MinGW on Windows
Vista but encounter this strange error:

OGLFT.cpp: In member function `void OGLFT::Filled::init()':
OGLFT.cpp:2538: error: invalid conversion from `void (*)()' to `void (*)()'
OGLFT.cpp:2538: error: initializing argument 3 of `void
gluTessCallback(GLUtesselator*, GLenum, void (*)())'

How could "void (*)()" not be the same as "void (*)()"?

The actual line of source looks like this:

gluTessCallback( tess_obj_, GLU_TESS_VERTEX,
(GLUTessCallback)vertexCallback );

where vertexCallback is defined as:

void Filled::vertexCallback ( VertexInfo* vertex )
{
if ( vertex->color_tess_ != 0 )
glColor4fv( vertex->color_tess_->color( vertex->v_ ) );

if ( vertex->texture_tess_ != 0 )
glTexCoord2fv( vertex->texture_tess_->texCoord( vertex->v_ ) );

glVertex3dv( vertex->v_ );
}

I am new to C++ so I am not sure how much more of the code I need to show
you. I guess I just can't understand what the error message is actually
trying to say.

--
And loving it,

-Qu0ll (Rare, not extinct)
_________________________________________________

[Replace the "SixFour" with numbers to email me]

 
Reply With Quote
 
 
 
 
James Kanze
Guest
Posts: n/a
 
      04-26-2009
On Apr 25, 10:59 am, "Qu0ll" <Qu0llSixF...@gmail.com> wrote:
> I am trying to compile the open source OGLFT library with
> MinGW on Windows Vista but encounter this strange error:


> OGLFT.cpp: In member function `void OGLFT::Filled::init()':
> OGLFT.cpp:2538: error: invalid conversion from `void (*)()' to `void (*)()'
> OGLFT.cpp:2538: error: initializing argument 3 of `void
> gluTessCallback(GLUtesselator*, GLenum, void (*)())'


> How could "void (*)()" not be the same as "void (*)()"?


It's a very bad error message. Given the little bit of code you
show, it's clearly omitting both the parameter types and the
fact that the function is a member (supposing that Filled is a
class, and not a namespace).

> The actual line of source looks like this:
>
> gluTessCallback( tess_obj_, GLU_TESS_VERTEX,
> (GLUTessCallback)vertexCallback );


> where vertexCallback is defined as:


> void Filled::vertexCallback ( VertexInfo* vertex )
> {
> if ( vertex->color_tess_ != 0 )
> glColor4fv( vertex->color_tess_->color( vertex->v_ ) );
> if ( vertex->texture_tess_ != 0 )
> glTexCoord2fv( vertex->texture_tess_->texCoord( vertex->v_ ) );
> glVertex3dv( vertex->v_ );
> }


It would help if we could also see the declaration of
gluTessCallback, to see what it is expecting. And what
GLUTessCallback is. However, if Filled is a class, then the
expression (GLUTessCallback)vertexCallback shouldn't compile,
regardless---the only thing you can do with a member function is
call it (using an instance of the class, so you need a . or a ->
operator to the left, and a () operator to the right), or take
its address, in which case, you must use a qualified id and the
address of operator, e.g.:
&Filled::vertexCallback.
No other uses are legal.

> I am new to C++ so I am not sure how much more of the code I
> need to show you. I guess I just can't understand what the
> error message is actually trying to say.


It is more than vague. But to answer fully your question, we
need to know 1) whether Filled is a class or a namespace, 2) how
GLUTessCallback is defined, and 3) the signature (declaration)
of gluTessCallback.

--
James Kanze (GABI Software) email:
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
strange syntax error _wolf Python 1 06-04-2010 06:42 PM
Syntax error? What syntax error? Assignment fo default values? Mark Richards Perl Misc 3 11-18-2007 05:01 PM
Syntax bug, in 1.8.5? return not (some expr) <-- syntax error vsreturn (not (some expr)) <-- fine Good Night Moon Ruby 9 07-25-2007 04:51 PM
Question About Strange 'C' Code Syntax ( Well strange to me anyway ) Harvey Twyman C Programming 8 10-25-2003 05:54 AM
Strange IRB Syntax Error Robert Klemme Ruby 2 06-27-2003 03:08 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57