jason
jason

Reputation: 7164

Compiling and running OpenGL codes on Netbeans

I can run my C++ codes that use OpenGL on Terminal with the following code :

g++ -Wall main.cpp -lglut -lGL -lGLU -lGLEW 

I want to use Netbeans while I'm working on OpenGL. When I write the code on Netbeans and run I get many errors like :

/home/../NetBeansProjects/CppApplication_2/main.cpp:36: undefined reference to `glutInit'

How can I make Netbeans compile and run my code correctly? Do I need to edit the makefile, if yes, how?

Upvotes: 1

Views: 3104

Answers (1)

Dinesh Subedi
Dinesh Subedi

Reputation: 2663

You have to link the GLUT library. Follow the following setps for windows machine:

  1. Copy the glut.dll file to the c:\windows\system32 folder.
  2. Go to project properties and select compiler. In include option add the glut include directories (glut.h)
  3. select linker and in libraries option add the glut.lib or libglut.a file.

Follow this answer for details NetBeans with C++ and OpenGL / Freeglut under Windows 7

http://forums.netbeans.org/post-29474.html

Upvotes: 2

Related Questions