I wanted to learn OpenGl with Cpp using QT-Creator but it seems that i didn't linked my GLFW lib right.
I used
sudo apt-get install libglfw3 libglfw3-dev libglfw3-doc
and
sudo apt-get install libglew-dbg libglew-dev libglew1.13
to install them and afterwards, the QT_Creator "showed" me
//GLEW
#include "GL/glew.h"
//GLFW
#include "GLFW/glfw3.h"
so I thought, I could use them, but i got an "undifened reference to ...". I already looked at this question, but it doesn't seem to work. And I never worked with CMake or qmake before, so i can't see my mistake.
I can provide my enviroment setup notes for you, or you can read it from my sites, But prevent my site url from invalid someday, I rewrite it here.
First. we need to install dependencies on ubuntu
sudo apt-get install xorg-dev
sudo apt-get install libglu1-mesa-dev
Then download source package at official
Extract your package and open your terminal, then cd to what your package location which you just extracted.
Do following commnad to install
make extension
make
sudo make install
sudo make clean
Open a console project in QT
Add following settings in your .pro file anywhere.
LIBS +=-lGLEW -lglfw3 -lGL -lX11 -lXi -lXrandr -lXxf86vm -lXinerama -lXcursor -lrt -lm -pthread
Try a simple test.
#define GLEW_STATIC
#include <GL/glew.h>
#include<GLFW/glfw3.h>
int main(int argc, char *argv[])
{
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);
return 0;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With