OpenGL with GLFW and GLEW - compiling with gcc on windows - c++

I'm trying to run an OpenGL program that uses GLFW and GLEW libraries I built myself. The starter code I use is
#include <iostream>
// GLEW
#define GLEW_STATIC
#include <glew.h>
// GLFW
#include <glfw3.h>
// Function prototypes
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode);
// Window dimensions
const GLuint WIDTH = 800, HEIGHT = 600;
// The MAIN function, from here we start the application and run the game loop
int main()
{
std::cout << "Starting GLFW context, OpenGL 3.3" << std::endl;
// Init GLFW
glfwInit();
// Set all the required options for GLFW
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
// Create a GLFWwindow object that we can use for GLFW's functions
GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "LearnOpenGL", 0, 0);
glfwMakeContextCurrent(window);
if (window == NULL)
{
std::cout << "Failed to create GLFW window" << std::endl;
glfwTerminate();
return -1;
}
// Set the required callback functions
glfwSetKeyCallback(window, key_callback);
// Set this to true so GLEW knows to use a modern approach to retrieving function pointers and extensions
glewExperimental = GL_TRUE;
// Initialize GLEW to setup the OpenGL Function pointers
if (glewInit() != GLEW_OK)
{
std::cout << "Failed to initialize GLEW" << std::endl;
return -1;
}
// Define the viewport dimensions
glViewport(0, 0, WIDTH, HEIGHT);
// Game loop
while (!glfwWindowShouldClose(window))
{
// Check if any events have been activated (key pressed, mouse moved etc.) and call corresponding response functions
glfwPollEvents();
// Render
// Clear the colorbuffer
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
// Swap the screen buffers
glfwSwapBuffers(window);
}
// Terminate GLFW, clearing any resources allocated by GLFW.
glfwTerminate();
return 0;
}
// Is called whenever a key is pressed/released via GLFW
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode)
{
std::cout << key << std::endl;
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
}
Then I type
g++ -I<path to headers> Tma.cpp -L<path to libraries> -lglu32 -lopengl32 -lglfw3 -lglew32
Which yields a number of 'undefined reference to' errors.
The code should be OK, as I previously run it successfully in Visual Studio.

This command:
g++ -I<path to headers> Tma.cpp -L<path to libraries> -lglu32 -lopengl32 -lglfw3 -lglew32
will not be enough in Windows. You will need to link additional system libraries. For example, every project in Visual Studio 2012 have these attached by default:
kernel32.lib
user32.lib
gdi32.lib
winspool.lib
comdlg32.lib
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib
odbccp32.lib
That is why it compiled fine in VS.
kernel32.lib and user32.lib should be always linked. gdi32.lib is required, when you do any graphic operations.
First solution:
Link these libraries manually:
g++ -I<path to headers> Tma.cpp -L<path to libraries> -lglu32 -lopengl32 -lglfw3 -lglew32 -lkernel32 -luser32 -lgdi32 -lws2_32
If I remember correctly, ws2_32.a is the name of WinSock2 library supplied with MinGW.
Second solution:
If you use MinGW, you can use -mwindows flag:
g++ -I<path to headers> Tma.cpp -L<path to libraries> -lglu32 -lopengl32 -lglfw3 -lglew32 -mwindows
This will link, among few others, gdi32.a, kernel32.a, user32.a and ws2_32.a.

Related

OpenGL C++ undefined reference to symbol 'glViewport' [duplicate]

This question already has answers here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
(39 answers)
Linking GLEW with CMake
(6 answers)
Closed last month.
When I try to compile it, I get a strange error:
[domon#archlinux TileVox-engine]$ g++ -c engine_main.cpp
[domon#archlinux TileVox-engine]$ g++ engine_main.o -o game -L -lGL -lglfw -lGLEW -lglut -lGLU
/usr/bin/ld: engine_main.o: undefined reference to symbol 'glViewport'
/usr/bin/ld: /usr/lib/libGL.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Code:
#include <iostream>
#define GLEW_STATIC
#include <GL/glew.h>
#include <GLFW/glfw3.h>
using namespace std;
int window_width = 1280;
int window_height = 720;
int main()
{
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
GLFWwindow* window = glfwCreateWindow(window_width, window_height, "TileVox-engine: Main scene", nullptr, nullptr);
if (window == nullptr){
cout << "TileVox-engine Error: failed to create OpenGL profile";
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
glewExperimental = GL_TRUE;
if (glewInit() != GLEW_OK){
cout << "OpenGL Error: starting failed";
}
glViewport(0,0, window_width, window_height);
while (!glfwWindowShouldClose(window))
{
glfwPollEvents();
glfwSwapBuffers(window);
}
glfwTerminate();
return 0;
}
But there are no errors here, and I compiled and added the libraries correctly, what could be the problem?

GLEW and GLFW undefined references

I am trying to set up openGl with glfw and glew. This is the source code:
#define GLFW_INCLUDE_GLU
#ifdef _WIN32
#define GLFW_DLL // -> windows
#include <GL/glew.h>
#elif __linux__
#include <GL/glew.h>
#endif
#include <GLFW/glfw3.h>
#include <iostream>
#include <stdexcept>
GLFWwindow* window = NULL;
GLFWmonitor* monitor = NULL;
int window_width = 800;
int window_height = 600;
static void window_hints() {
const GLFWvidmode* mode = glfwGetVideoMode(monitor);
glfwWindowHint(GLFW_RED_BITS, mode->redBits);
glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits);
glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits);
glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate);
glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);
}
static void set_window_callbacks() {
glfwSetWindowCloseCallback(window, [] (GLFWwindow *window) {
std::cout << "closing window!";
});
glfwSetKeyCallback(window, [] (GLFWwindow *window, int key,int scancode, int action, int mods) {
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) {
glfwSetWindowShouldClose(window, GLFW_TRUE);
}
});
glfwSetWindowSizeCallback(window, [] (GLFWwindow *window, int width, int height) {
glViewport(0, 0, width, height);
window_width = width;
window_height = height;
glLoadIdentity();
GLdouble aspect = (GLdouble)window_width / window_height;
glOrtho(-1, 1, -1 / aspect, 1 / aspect, 0.01, 10000);
glTranslatef(0, 0, -10);
});
}
void GLAPIENTRY
MessageCallback( GLenum source,
GLenum type,
GLuint id,
GLenum severity,
GLsizei length,
const GLchar* message,
const void* userParam )
{
fprintf( stderr, "GL CALLBACK: %s type = 0x%x, severity = 0x%x, message = %s\n",
( type == GL_DEBUG_TYPE_ERROR ? "** GL ERROR **" : "" ),
type, severity, message );
}
int main(int argc, char *argv[])
{
glfwSetErrorCallback([] (int code, const char * err_msg) {
std::cerr << "GLFW Error " << code << ": \n\t" << err_msg << std::endl;
});
if(!glfwInit())
throw std::runtime_error("glfwInit failed");
monitor = glfwGetPrimaryMonitor();
window_hints();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
window = glfwCreateWindow(window_width, window_height, "test window", NULL, NULL);
if(!window)
throw std::runtime_error("glfwOpenWindow failed.");
set_window_callbacks();
// GLFW settings
glfwMakeContextCurrent(window);
glewInit();
glfwSwapInterval(1);
std::cout << glGetString(GL_VERSION) << std::endl;
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
glDebugMessageCallback(MessageCallback, 0);
glMatrixMode(GL_PROJECTION);
glViewport(0, 0, window_width, window_height);
glLoadIdentity();
GLdouble aspect = (GLdouble)window_width / window_height;
glOrtho(-1, 1, -1 / aspect, 1 / aspect, 0.01, 10000);
glTranslatef(0, 0, -10);
while(!glfwWindowShouldClose(window))
{
// process pending events
glfwPollEvents();
glClearColor(0, 0, 0, 1); // black
glClear(GL_COLOR_BUFFER_BIT);
//glRotatef(1, 0, 0, 0.1);
glBegin(GL_TRIANGLES);
glColor3f(1.0, 0.0, 0.0);
glVertex2f(-0.5, -0.5);
glColor3f(0.0, 1.0, 0.0);
glVertex2f( 0.5, -0.5);
glColor3f(0.0, 0.0, 1.0);
glVertex2f( 0.0, 0.5);
glEnd();
glfwSwapBuffers(window);
}
// clean up and exit
glfwTerminate();
std::cerr << std::endl;
return 0;
}
And this works perfectly under Linux with the following makefile:
main: main.cpp makefile
g++ main.cpp -g -o main -lglfw -lGL -lX11 -lGLEW -std=c++2a
Then, I wanted to make it to compile under windows too, so I tried with this makefile:
main.exe: main.cpp makefile
g++ main.cpp -g -o main.exe -I"D:\cpp_libraries\glfw-3.3.5.bin.WIN64\include" -I"D:\cpp_libraries\glew-2.1.0\include" -L"D:\cpp_libraries\glfw-3.3.5.bin.WIN64\lib-mingw-w64" -L"D:\cpp_libraries\glew-2.1.0\lib\Release\x64" -lglfw3dll -lglew32 -lopengl32
Here, "glew-2.1.0" and "glfw-3.3.5.bin.WIN64" are downloaded from the respective download pages for precompiled windows binaries. I have added "D:\cpp_libraries\glew-2.1.0\bin\Release\x64" and "D:\cpp_libraries\glfw-3.3.5.bin.WIN64\lib-mingw-w64" to the Path environment variable as they contain glew32.dll and glfw3.dll.
When I try to compile, g++ gives "undefined reference to " every single glew/gl/glfw function call. I also tried running the same g++ command through VS Code's tasks.json with the same result.
Then I noticed that everyone on the internet said I must link against "glfw3.lib" and I noticed that the first -L argument to g++ is a folder that does not actually contain any .lib files as it should. But I cannot find the "glfw3.lib" anywhere in the zip I downloaded earlier. I even tried building glfw from source with CMake, Make and Code::Blocks, but none of them generated a .lib file I can link against.
Edit: I forgot to mention that I have not added the dlls to my project directory, but it really should not be necessary. I tried it anyway and it didn't fix the problem.
Edit 2: it would be better to link with -lglfw, not -lglfwdll, so I changed that.
Edit 3: actually, gl functions are getting linked fine. The problem is only with glfw and glew.
I finally got it working. It turns out the precompiled binaries for glew and glfw do not work on my machine. I had to download both sources and compile the libraries myself. This is the makefile that finally works:
main.exe: main.cpp makefile
g++ main.cpp -g -o main.exe -I"D:/cpp_libraries/glfw-3.3.5-source/include" -I"D:/cpp_libraries/glew-2.1.0-source/include" -L"D:/cpp_libraries/glfw-3.3.5-compiled/src" -L"D:/cpp_libraries/glew-2.1.0-compiled/lib" -lglfw3 -lglew32 -lopengl32

I cant get GLEW to work on netbeans in ubuntu 20.04 (C++)

I managed to get GLFW3 to work and properly display a window, however when i add glewInit() to my project it tells me undefined reference to glewInit'. I am using g++ as my compiler with -lglfw3 and lGl as flags. Below is a simple project to demonstrate my issue. I am on linux. Any help is much appreicated.
#include <GL/glew.h>
#include <GL/gl.h>
#include <GLFW/glfw3.h>
#include <iostream>
// settings
const unsigned int SCR_WIDTH = 800;
const unsigned int SCR_HEIGHT = 600;
int main()
{
// glfw: initialize and configure
// ------------------------------
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
// glfw window creation
GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "LearnOpenGL", NULL, NULL);
if (window == NULL)
{
std::cout << "Failed to create GLFW window" << std::endl;
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
// here is the error, my glew is not intializing :(
if(glewInit() != GLEW_OK) {
return 0;
}
// render loop
while (!glfwWindowShouldClose(window))
{
// render
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
// glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)
glfwSwapBuffers(window);
glfwPollEvents();
}
// glfw: terminate, clearing all previously allocated GLFW resources.
glfwTerminate();
return 0;
}
There is a standard way on Linux to get a correct set of libraries to link with your program - please look at man pkg-config. In your case you need to link everything, which is needed by both GLFW3 and GLEW - so you should call the pkg-config two times:
hekto#ubuntu:~$ pkg-config --libs glfw3
-lglfw
hekto#ubuntu:~$ pkg-config --libs glew
-lGLEW -lGLU -lGL
Therefore, you need to use -lglfw instead of -lglfw3 and add two more libraries - -lGLEW and -lGLU. These calls to the pkg-config tool can be directly added to your Makefile as well.

glew32s.lib undfined reference

I use MinGW compiler and Code::Blocks IDE, 16.01.
I have interested in graphic library OpenGL. I've started to find articles and found one.
I've set up glew, freeglut and glfw by myself without using cMaker. Then, I've decided to link libraries into the project. So, I have the following sequence in Linker settings:
C:\MinGW\lib\glew\glew32s.lib
C:\MinGW\lib\freeglut\libfreeglut.a
C:\MinGW\lib\freeglut\libfreeglut_static.a
C:\MinGW\lib\glfw\libglfw3dll.a
C:\MinGW\lib\glfw\libglfw3.a
Following by this tutorial (in russian language) I've written in linker settings glew32s.lib (with 's'), 'cause it's a static library and I need this one. After that I've tried to compile but get these errors:
C:\MinGW\lib\glew\glew32s.lib(tmp\glew_static\Release\Win32\glew.obj):(.text$mn+0x7)||undefined reference to `_imp__wglGetProcAddress#4'|
C:\MinGW\lib\glew\glew32s.lib(tmp\glew_static\Release\Win32\glew.obj):(.text$mn+0x4)||undefined reference to `_imp__wglGetProcAddress#4'|
The code I've tried to compile is:
#include <iostream>
// GLEW
#define GLEW_STATIC
#include <GL/glew.h>
// GLFW
#include <GLFW/glfw3.h>
// Function prototypes
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode);
// Window dimensions
const GLuint WIDTH = 800, HEIGHT = 600;
// The MAIN function, from here we start the application and run the game loop
int main()
{
std::cout << "Starting GLFW context, OpenGL 3.3" << std::endl;
// Init GLFW
glfwInit();
// Set all the required options for GLFW
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
// Create a GLFWwindow object that we can use for GLFW's functions
GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "LearnOpenGL", nullptr, nullptr);
if (window == nullptr)
{
std::cout << "Failed to create GLFW window" << std::endl;
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
// Set the required callback functions
glfwSetKeyCallback(window, key_callback);
// Set this to true so GLEW knows to use a modern approach to retrieving function pointers and extensions
glewExperimental = GL_TRUE;
// Initialize GLEW to setup the OpenGL Function pointers
if (glewInit() != GLEW_OK)
{
std::cout << "Failed to initialize GLEW" << std::endl;
return -1;
}
// Define the viewport dimensions
int width, height;
glfwGetFramebufferSize(window, &width, &height);
glViewport(0, 0, width, height);
// Game loop
while (!glfwWindowShouldClose(window))
{
// Check if any events have been activiated (key pressed, mouse moved etc.) and call corresponding response functions
glfwPollEvents();
// Render
// Clear the colorbuffer
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
// Swap the screen buffers
glfwSwapBuffers(window);
}
// Terminate GLFW, clearing any resources allocated by GLFW.
glfwTerminate();
return 0;
}
// Is called whenever a key is pressed/released via GLFW
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode)
{
std::cout << key << std::endl;
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
}
Then I wrote in linker settings glew32.lib (without 's'), comment glewExperimental = GL_TRUE; line and try again.
The program was compiled successfully. It was run and the result was as it must be.
But I want to use a static library instead of dynamic. How can it be solved?
I guess that library 'glew32s.lib' is built with Visual studio. So you cannot link with it unless you change your compiler.
I suggest you get a GLEW library built with MinGW or build one by yourself. Libraries for MinGW are named 'libNAME.a',
Also, dynamic libraries have no limitation on its name, so there could be no difference between static library (instead, they are named, like, libNAME_static.a or libNAMEs.a, ...)

GLFW Undefined Reference to many things

I have tried several times in the past to write programs using OpenGL in C and C++ on several platforms, every time only to be stopped by the ridiculous dependency and linking issues that inevitably come up.
I am attempting to use GLFW with C++ on a linux system, building using CMake, with absolutely no success.
CMakeLists.txt:
cmake_minimum_required(VERSION 2.8)
project( GL_TEST_PROJECT )
find_package(OpenGL REQUIRED)
if(NOT OPENGL_FOUND)
message("ERROR: OpenGL not found")
endif(NOT OPENGL_FOUND)
set(GL_LIBRARY GL GLU X11)
add_executable(testgl testgl.cpp)
target_link_libraries(testgl glfw3 Xxf86vm pthread dl Xi Xcursor Xrandr X11 ${GL_LIBRARY} m)
testgl.cpp:
#include <GLFW/glfw3.h>
#include <stdlib.h>
#include <stdio.h>
static void error_callback(int error, const char* description)
{
fputs(description, stderr);
}
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
}
int main(void)
{
GLFWwindow* window;
glfwSetErrorCallback(error_callback);
if (!glfwInit())
exit(EXIT_FAILURE);
window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL);
if (!window)
{
glfwTerminate();
exit(EXIT_FAILURE);
}
glfwMakeContextCurrent(window);
glfwSetKeyCallback(window, key_callback);
while (!glfwWindowShouldClose(window))
{
float ratio;
int width, height;
glfwGetFramebufferSize(window, &width, &height);
ratio = width / (float) height;
glViewport(0, 0, width, height);
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-ratio, ratio, -1.f, 1.f, 1.f, -1.f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glRotatef((float) glfwGetTime() * 50.f, 0.f, 0.f, 1.f);
glBegin(GL_TRIANGLES);
glColor3f(1.f, 0.f, 0.f);
glVertex3f(-0.6f, -0.4f, 0.f);
glColor3f(0.f, 1.f, 0.f);
glVertex3f(0.6f, -0.4f, 0.f);
glColor3f(0.f, 0.f, 1.f);
glVertex3f(0.f, 0.6f, 0.f);
glEnd();
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwDestroyWindow(window);
glfwTerminate();
exit(EXIT_SUCCESS);
}
make output:
Linking CXX executable testgl
//usr/local/lib/libglfw3.a(x11_init.c.o): In function `initExtensions':
x11_init.c:(.text+0x1b8b): undefined reference to `XineramaQueryExtension'
x11_init.c:(.text+0x1ba3): undefined reference to `XineramaIsActive'
//usr/local/lib/libglfw3.a(x11_monitor.c.o): In function `_glfwPlatformGetMonitors':
x11_monitor.c:(.text+0x672): undefined reference to `XineramaQueryScreens'
collect2: error: ld returned 1 exit status
make[2]: *** [testgl] Error 1
make[1]: *** [CMakeFiles/testgl.dir/all] Error 2
make: *** [all] Error 2
I have tried several different changes to the CMakeLists.txt file, including removing and adding different dependencies, but it seems that there is nowhere for me to go from here. What do I need to do to get this program to compile?
Using the
set(CMAKE_CXX_FLAGS ...)
Does not work for me, but adding them all into
set(GLFW_DEPS X11 Xrandr Xinerama Xxf86vm Xcursor GL dl pthread)
Does get things working.
So, my target_link_libraries looks like this
target_link_libraries( ${PROJECT_NAME} glfw3 ${GLFW_DEPS} ${GLEW_STATIC_LIBRARY} )
It is possible that I'm not using CMAKE_CXX_FLAGS correctly, but you should try just adding the libraries your self. Do be careful about it, their order is important and depending on which version of GLFW you're using they could be different.
That error your getting is strictly because your missing the Xinerama library.
There are two ways to not have to add those libraries manually:
Option 1 is to use GLFW_LIBRARIES which you would have to include glfw source into your project as stated here build with Cmake and GLFW source
Option 2 would be to use the help of find_package as described here: Build with installed GLFW binaries
It appears as though you have glfw installed on your machine so I would recommend option 2, in part because I have yet to get option 1 to work and I'm currently having to manually enter the libraries. This is because I don't want to have glfw installed on machine vs having it all contained in the project.
Add this to "target_link_libraries()":
glfw ${GLFW_LIBRARIES} ${X11_LIBRARIES}
And then add this somewhere above "include_directories" in your CMakeLists.txt file:
#########################################################
# FIND X11
#########################################################
find_package(X11 REQUIRED)
include_directories(${X11_INCLUDE_DIRS})
link_directories(${X11_LIBRARY_DIRS})
add_definitions(${X11_DEFINITIONS})
if(NOT X11_FOUND)
message(ERROR " X11 not found!")
endif(NOT X11_FOUND)
Edit #2: And try adding the following to your CMakeLists.txt
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lglfw3 -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -lGL -lpthread")