I've got a program I'm attempting to port from Red Hat Enterprise Linux 3 to 
Cygwin (on Windows).
 
g++ -v in Cygwin reveals: gcc version 3.4.4
g++ -v in Red Hat reveals: gcc version 3.2.3-52
 
There's the background.  Here's the problem:
 
I'm attempting to cast a function pointer in the following C++ code:
 
------------------------------------------
/* ... includes and what not ... */
 
void tcbBegin(GLenum prim) { 
    cout << "BEGIN"; 
}
 
/* ... */
 
void tessellateTest() {
 //Allocate a new GLU tessellation object
 GLUtesselator *tess = gluNewTess();
 
 //Assigning callbacks
 
 //begin callback
 gluTessCallback(tess,GLU_TESS_BEGIN, (void(*)()) tcbBegin);    // THIS IS LINE 
71 //
 
/* ... */
--------------------------------------
 
When compiling, this error happens in Cygwin:
test.cpp:72: error: invalid conversion from `void (*)()' to `void (*)()'
 
No error occurs in Red Hat.  The cast works just fine, and I've used this code 
with no problem for several months.
 
Not casting at all results in this error (on both Red Hat and Cygwin):
test.cpp:71: error: invalid conversion from `void (*)(GLenum)' to `void (*)()'
 
My compile line in Cygwin looks like:
$ g++ test.cpp -lglu32 -lopengl32
 
And in Red Hat it looks like:
$ g++ test.cpp -lGLU -lGL

Any idea whats going on?  It seems to me that the cast should be legal.  Have 
the rules changed in g++ between the two versions? I have already tried using a 
reinterpret_cast, but that didn't work.
 
Thanks,
 
Mike Day
Virtual Targets Center
https://modelexchange.army.mil/
 

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply via email to