PDA

View Full Version : openGL in windows using netbeans



sbarratt
07-24-2009, 04:24 PM
I've used openGL before but I've never been very good and setting up IDEs to use the libraries I want. So I'm using netbeans 6.7 and I'm trying to run openGL for C/C++ (I program in C). As far as I can tell I've installed all the correct things, gl.h, glut.h, glu32, opengl32, glut32 libraries, I've run mulitple tutorials and to no avail. I've finally come to rest on this last error:

gcc -g -O0 -Wall main.c -lglut32 -lglu32 -lopengl32 -o myprog
/cygdrive/c/DOCUME~1/SHANNO~1.BAR/LOCALS~1/Temp/ccJZxZ2f.o: In function `main':
/cygdrive/t/mine/projects/consoleApp/CppApplication_1/main.c:31: undefined reference to `_glutInit'
/cygdrive/t/mine/projects/consoleApp/CppApplication_1/main.c:32: undefined reference to `_glutInitDisplayMode'
/cygdrive/t/mine/projects/consoleApp/CppApplication_1/main.c:33: undefined reference to `_glutInitWindowSize'
/cygdrive/t/mine/projects/consoleApp/CppApplication_1/main.c:34: undefined reference to `_glutInitWindowPosition'
/cygdrive/t/mine/projects/consoleApp/CppApplication_1/main.c:35: undefined reference to `_glutCreateWindow'
/cygdrive/t/mine/projects/consoleApp/CppApplication_1/main.c:36: undefined reference to `_glutDisplayFunc'
/cygdrive/t/mine/projects/consoleApp/CppApplication_1/main.c:37: undefined reference to `_glutReshapeFunc'
/cygdrive/t/mine/projects/consoleApp/CppApplication_1/main.c:38: undefined reference to `_glutMainLoop'
collect2: ld returned 1 exit status
make: *** [myprog] Error 1


My makefile looks as follows:
COMPILER = gcc
CCFLAGS = -g -O0 -Wall
myprog: main.c
${COMPILER} ${CCFLAGS} main.c -lglut32 -lglu32 -lopengl32 -o myprog

..and I've changed the link line to a variety of different things, I've tried the relative path -L/usr/include/w32api, I've changed the order, I've done a ton. The most notable problem I run into, which I'm guessing is the culprit is the error I get when I include -lglut -lGL -lGLU

gcc -g -O0 -Wall main.c -L/usr/include/w32api -lGL -lGLU -lglut32 -lglu32 -lopengl32 -o myprog
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -lGL
collect2: ld returned 1 exit status
make: *** [myprog] Error 1

Which leads me to believe that I've installed something wrong. I've gone into the project properties and added opengl32.lib glu32.lib glut32.lib to the 'Additional Library Directories' and -lopengl32 -lglu32 -lglut32 to the 'Libraries' tab.

Pretty much I've totally run into a wall, the only thing I've really found is stuff for openGL java in netbeans and then I found something that was in C++, which didn't work either.

Can someone please help me?

sbarratt
07-28-2009, 03:08 PM
well i fixed it...added a few libraries to the link line...i still can't get it to run in netbeans though, works in cygwin

rickypaz
08-02-2009, 06:27 PM
i have the same problem, but shown warnings are

gcc-3.exe -o dist/Debug/Cygwin-Windows/opengl -s build/Debug/Cygwin-Windows/teste.o -lglut32 -lglu32 -lopengl32 -lglaux -lgdi32 -lwinmm
/usr/lib/w32api/libglut32.a(glut_swap.o):glut_swap.c:(.text+0xcb): undefined reference to `__imp___iob'
/usr/lib/w32api/libglut32.a(glut_util.o):glut_util.c:(.text+0x3f): undefined reference to `__imp___iob'
/usr/lib/w32api/libglut32.a(glut_util.o):glut_util.c:(.text+0x5c): undefined reference to `__imp___iob'
/usr/lib/w32api/libglut32.a(glut_util.o):glut_util.c:(.text+0x75): undefined reference to `__imp___iob'
/usr/lib/w32api/libglut32.a(glut_util.o):glut_util.c:(.text+0xa4): undefined reference to `__flsbuf'
/usr/lib/w32api/libglut32.a(glut_util.o):glut_util.c:(.text+0xec): undefined reference to `__imp___iob'
/usr/lib/w32api/libglut32.a(glut_util.o):glut_util.c:(.text+0x109) : undefined reference to `__imp___iob'
/usr/lib/w32api/libglut32.a(glut_util.o):glut_util.c:(.text+0x122) : undefined reference to `__imp___iob'
/usr/lib/w32api/libglut32.a(glut_util.o):glut_util.c:(.text+0x16c) : undefined reference to `__flsbuf'
/usr/lib/w32api/libglut32.a(glut_util.o):glut_util.c:(.text+0x1af) : undefined reference to `__imp___iob'
/usr/lib/w32api/libglut32.a(glut_util.o):glut_util.c:(.text+0x1cc) : undefined reference to `__imp___iob'
/usr/lib/w32api/libglut32.a(glut_util.o):glut_util.c:(.text+0x1e5) : undefined reference to `__imp___iob'
/usr/lib/w32api/libglut32.a(glut_util.o):glut_util.c:(.text+0x211) : undefined reference to `__flsbuf'

I use more libraries than you, these libraries are used by devcpp, i thought it would work in netbeans :(