Salve a tutti, mi si presenta il seguente problema nonostante abbia incluso tutte le librerie necessarie:
gcc -o"OpenGLVersion" ./OpenGLVersion.o -lglut -lglu
/usr/bin/ld: cannot find -lglu
collect2: ld returned 1 exit status
make: *** [OpenGLVersion] Error 1
Il codice è il seguente:
Ho messo nelle proprietà del progetto la libreria glut e glu... Ho provato anche solo con glut, ma ci sono sempre problemi con GLU.codice:#include <GL/glut.h> #include <GL/glu.h> #include <stdlib.h> void init(void) { printf("OpenGL version: %s\n", glGetString(GL_VERSION)); printf("Vendor: %s\n", glGetString(GL_VENDOR)); printf("Renderer: %s\n", glGetString(GL_RENDERER)); printf("externsions: %s\n", glGetString(GL_EXTENSIONS)); glClearColor (0.0, 0.0, 0.0, 0.0); } void display(void) { glClear (GL_COLOR_BUFFER_BIT); glFlush (); } void reshape (int w, int h) { glViewport (0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode (GL_PROJECTION); glLoadIdentity (); gluOrtho2D (0.0, (GLdouble) w, 0.0, (GLdouble) h); } void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: exit(0); break; } } int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); glutInitWindowSize (400, 150); glutInitWindowPosition (100, 100); glutCreateWindow (argv[0]); init (); glutDisplayFunc(display); glutReshapeFunc(reshape); glutKeyboardFunc(keyboard); glutMainLoop(); return 0; }
I problemi girano tutti intorno alla funzione gluOrtho...Ho provato a commentare la riga e la compilazione va a buon fine e mi compare a video una schermata nera (non è quello che voglio).

Rispondi quotando