Currently I'm using this tutorial to get started with opengl.So when I try to compile the example program :
#include <GLFW/glfw3.h>
#include <thread>
int main()
{
glfwInit();
std::this_thread::sleep_for(std::chrono::seconds(1));
glfwTerminate();
}
using
g++ test.cpp -o test -lglfw3
to ensure that all is good with glfw I get this
In file included from /usr/include/c++/4.8/thread:35:0, from test.cpp:2: /usr/include/c++/4.8/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options. #error This file requires compiler and library support for the \ ^ test.cpp: In function ‘int main()’: test.cpp:7:10: error: ‘std::this_thread’ has not been declared std::this_thread::sleep_for(std::chrono::seconds(1)); ^ test.cpp:7:38: error: ‘std::chrono’ has not been declared std::this_thread::sleep_for(std::chrono::seconds(1));
So then I guessed I could use the flag that g++ suggested and compile it using
g++ -std=c++11 test.cpp -o test -lglfw3
But then things get weirder and g++ comes with this error(I will post only a part of it since it's a huge output overall but you will probably get the idea) :
x11_window.c:(.text+0x2d9): undefined reference to
XSaveContext' x11_window.c:(.text+0x324): undefined reference to
XChangeWindowAttributes' x11_window.c:(.text+0x3be): undefined reference toXSetWMProtocols' x11_window.c:(.text+0x417): undefined reference to
XChangeProperty' x11_window.c:(.text+0x41c): undefined reference toXAllocWMHints' x11_window.c:(.text+0x48e): undefined reference to
XSetWMHints' x11_window.c:(.text+0x49d): undefined reference toXFree' x11_window.c:(.text+0x4a2): undefined reference to
XAllocSizeHints' x11_window.c:(.text+0x5ed): undefined reference toXSetWMNormalHints' x11_window.c:(.text+0x5fc): undefined reference to
XFree' x11_window.c:(.text+0x613): undefined reference toXAllocClassHint' x11_window.c:(.text+0x66c): undefined reference to
XSetClassHint' x11_window.c:(.text+0x67b): undefined reference toXFree' x11_window.c:(.text+0x6dc): undefined reference to
XISelectEvents' x11_window.c:(.text+0x71e): undefined reference toXRRSelectInput' //usr/local/lib/libglfw3.a(x11_window.c.o): In function
hideCursor': x11_window.c:(.text+0x7bd): undefined reference toXUngrabPointer' x11_window.c:(.text+0x7fb): undefined reference to
XDefineCursor' //usr/local/lib/libglfw3.a(x11_window.c.o): In functioncaptureCursor': x11_window.c:(.text+0x880): undefined reference to
XGrabPointer' //usr/local/lib/libglfw3.a(x11_window.c.o): In function `showCursor':
How could I fix this type of problem cause it really hurts my motivation to get into opengl. And please if you have in mind any better-hassle free guide for setting a proper opengl environment for deving with glfw and glew in linux/ubuntu , care to mention it.
UPDATE 1: http://pastebin.com/CPEwmbUZ <--- The whole output is here if anyone cares.