I am trying to setup OpenGL developing environment on Ubuntu.I installed all the libs including GLFW as I don't want to use GLUT.GLEW lib has been installed too.I am trying to set it all in NetBeans.I have never used it before and currently I am getting :
undefined reference to `glfwInit' error while running this simple code:
#include <stdio.h>
#include <cstdlib>
#include <iostream>
#include <GL/glew.h>
#include <GL/glfw.h>
#include "glm.hpp"
using namespace std;
using namespace glm;
int main(int argc, char** argv) {
/* init GLFW */
if(!glfwInit()){
fprintf(stderr,"failed to init GLFW");
}
return 0;
}
I am sure it is linker related problem.So I have added libglfw.a to Linker->Libraries and then got even more errors like these:
make[2]: Entering directory /home/sasmaster/NetBeansProjects/OpenGLDemo'
mkdir -p dist/Debug/GNU-Linux-x86 g++ -o dist/Debug/GNU-Linux-x86/opengldemo build/Debug/GNU-Linux-x86/main.o /usr/lib/libglfw.a
/usr/lib/libglfw.a(window.o): In function
glfwOpenWindow':
/usr/lib/libglfw.a(x11_init.o): In function _glfwPlatformInit':
/usr/lib/libglfw.a(x11_init.o): In function
_glfwPlatformInit':
/usr/lib/libglfw.a(x11_init.o): In function _glfwPlatformInit':
/usr/lib/libglfw.a(x11_init.o): In function
_glfwPlatformInit':
/usr/lib/libglfw.a(x11_init.o): In function _glfwPlatformTerminate':
/usr/lib/libglfw.a(x11_init.o): In function
_glfwPlatformTerminate':
/usr/lib/libglfw.a(x11_window.o): In function translateKey':
/usr/lib/libglfw.a(x11_window.o): In function
translateKey':
/usr/lib/libglfw.a(x11_window.o): In function translateKey':
/usr/lib/libglfw.a(x11_window.o): In function
translateChar':
...........
........................
What else should I link or install?
Update: Here it is said one should add LIBRARIES='-pthread -lglfw -lGL -lX11 -lGLU -lXxf86vm' But where should I add those in NetBeans properties? I tried put into the MakeFile and "linker options" too and nothing helped.
Update1 Compiling the main.cpp manually using this command:
**g++ main.cpp -o Game -lglfw -lGL -lGLU -lX11 -lpthread -lXxf86vm -lm**
Compiles fine.How do I link all these libs via NetBeans???