Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Subject: g++ problem when attempting to cast a function pointer in an OpenGL GLU callback Date: Wed, 20 Jul 2005 12:32:40 -0500 Message-ID: <1075213EFAF9BA4181A250B072635947F14C8A@AMR-EX6.ds.amrdec.army.mil> From: "Day, Michael A AMRDEC/UAH" To: Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id j6KHWsVs002174 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/