Hello,

I'm using cygwin on Vista, and have a problem running C++ code that contains calls to GLUT routines. I've isolated the problem down to a very simple piece of code, and have searched the web without being able to find help.

Note that I have packages opengl 1.1.0-8, freeglut 2.4.0-1, and gcc-g++ 3.4.4-3, and "uname -a" outputs
CYGWIN_NT-6.0 opticon-w 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 Cygwin

Here's the problem, as best as I can isolate it. If I create a file called main.cpp containing the following code:

#include <stdio.h>
#include <GL/glut.h>

int main( int argc, char *argv[] ) {
  if ( argc > 100 ) {
     // glutInit( &argc, argv );
     glClear(GL_COLOR_BUFFER_BIT);
  }
  char str[100];
  printf("Enter a string:");
  scanf("%s",str);
}

and then I compile it with

  g++ -o main main.cpp -lm -lglut32 -lglu32 -lopengl32

and then run the code without any arguments, it runs fine (note that the call to glClear() never happens). However, if I uncomment the call to the glutInit() routine and comment the glClear() call,

#include <stdio.h>
#include <GL/glut.h>

int main( int argc, char *argv[] ) {
  if ( argc > 100 ) {
     glutInit( &argc, argv );
     // glClear(GL_COLOR_BUFFER_BIT);
  }
  char str[100];
  printf("Enter a string:");
  scanf("%s",str);
}

and compile the same way and run again without any arguments, Windows Vista gives me an error message with the following details:

Nom d'événement de problème:            APPCRASH
Nom de l'application:                   main.exe
Version de l'application:               0.0.0.0
Horodatage de l'application:            49103229
Nom du module par défaut:               ntdll.dll
Version du module par défaut:           6.0.6001.18000
Version du module par défaut:           4791a7a6
Code de l'exception:                    c0000022
Décalage de l'exception:                00009cac
Version du système:                     6.0.6001.2.1.0.256.4
Identificateur de paramètres régionaux: 3084
etc.

Note, again, that the call to glutInit() never happens. I suspect that simply linking with GLUT somehow causes a problem, perhaps in some initialization of GLUT.

Note that I have tried running the main.exe as "administrator" (by right clicking on main.exe and choosing the "run as administrator" option from the right-click menu), and I get the same error message as when I try running main.exe from a cygwin shell prompt.

Any help would be appreciated, thanks.


--
Michael McGuffin, Assistant Professor
Department of Software and IT Engineering
Ecole de technologie superieure
1100 Notre-Dame Ouest
Montreal, Quebec, H3C 1K3, Canada
http://profs.logti.etsmtl.ca/mjm/


--
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