0

Ok, I can't really get to use OpenGL in NetBeans.

So I have Cygwin installed and the glut.h file in this path:

C:\cygwin64\usr\include\w32api\GL\glut.h

This is the default path where gl.h was, I only added glut.h ...

But when I include it NetBeans say: There are unresolved includes inside GL/glut.h as a warning, and when i run the glutInit(NULL, NULL); function it returns this error:

/cygdrive/c/Users/***/Documents/NetBeansProjects/***/main.cpp:8: undefined reference to `glutInit'
/cygdrive/c/Users/***/Documents/NetBeansProjects/***/main.cpp:8:(.text+0x18): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `glutInit'

Anyone know a solution or a complete tutorial on how to add the entire openGL to NetBeans?

svarog
  • 9,477
  • 4
  • 61
  • 77
XandruDavid
  • 67
  • 1
  • 8
  • 2
    GLUT is not part of OpenGL, and also not of the Win32 API. If you want to use it, you have to manually install it. – derhass Apr 21 '14 at 13:35

1 Answers1

0

You will have to install glut properly, and set up the include and linker path in your NetBeans in the project settings. There is a linker option in there and all kinds of build configurations.

Project Properties -> Build -> Linker -> Add Library File

This will help with solving the undefined reference issue which is basically some complain from the linker you are using.

As for the include path issue, you will need to do this:

Tools -> Options -> C/C++ -> C++ Compiler -> Include Directories

That is all you should get to set up for your glut usage in your software with NetBeans for starter, at least.

svarog
  • 9,477
  • 4
  • 61
  • 77
László Papp
  • 51,870
  • 39
  • 111
  • 135
  • Thanks, but how do i install glut properly? Tons of guides only tells to add the glut.h file where the gl.h is, the libglut32.a in the lib directory and the glut32.dll int sys32... Is that all? – XandruDavid Apr 21 '14 at 14:13
  • @XandruDavid: http://www.cs.uregina.ca/Links/class-info/315/WWW/Lab1/GLUT/windows.html – László Papp Apr 21 '14 at 14:15
  • Is it only for MSVC and MinGW? D: – XandruDavid Apr 21 '14 at 14:23
  • @XandruDavid: mingw might work in cygwin, but you really oughta drop cygwin, and use mingw instead. – László Papp Apr 21 '14 at 14:24
  • Ok thanks, i only got cygwin those days because i installed NetBeans and it asked me for a compiler... I used to use Dev-C++ witch does everything automatically... – XandruDavid Apr 21 '14 at 14:27
  • I've got MinGW installed and NetBeans configured to use it... I installed freeglut, i linked glu32, opengl32 and freeglut... but i still get: undefined reference to `_imp____glutInitWithExit@12' and other errors like this – XandruDavid Apr 21 '14 at 16:00