I respect guys, who can configure Vim/Emacs or Sublime to complete IDE, using a ton of plugins, but I just want to download and work. I had enough virtual sex, configuring proprietary Nvidia drivers and Touchpad gestures in Linux (it is worthy of separate post).
I chose
QtCreator.
sudo apt install qtcreator
New Project -> Non-Qt Project -> Plain C++ Application
Choose project location, and name it (for example
opengl-qt)
Define build system - I chose CMake, I want to make platform-independent project, also I don`t know pros and cons of qmake.
Kit Selection I was
surprised, that there are no kits in my laptop, and I don't even imagine, why we can't continue without this .....ing kit. But we can heal it:
sudo apt-get install qt5-default
(Thanks to the
link)
Holy cow! It creates a project, moreover it can easily compile and run by pressing
Ctrl + R !
Let's do the same OpenGL program, we created by native g++ compiler and text editor: https://s-march.blogspot.com/2018/05/creating-opengl-application-in-linux.html
- Copy and paste our code to main.cpp
- CMake. I used it before, to make project from sources, for example CMake made GLFW and GLM projects for theirs further compiling in Visual Studio in Windows.
Now I started manually configure CMake file by myself. I had hated it for an hour until I understood, how to link libraries. Ask me how?
Easy!
CMakeLists.txt
project(opengl-qt) #change to your project name
cmake_minimum_required(VERSION 2.8)
set(CMAKE_CXX_STANDARD 14) #for -std=c++14
aux_source_directory(. SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST})
target_link_libraries(${PROJECT_NAME} GLEW GL glfw)
Look at the last line! That`s the way to link libraries.
AAAAA!! Happiness!
Now we can create classes and make our weird stuff more weird. I will create my program, based on
learnopengl.com using classes and other C++ stuff.
1. If you have done the same stuff, but it does not work - ask me, maybe I`ll be able to help.
2. Feel free to improve my mistakes and explain something if my dumbness make you cry.
Thank you for watching!