Ubuntu Clion 配置OpenGL

在主源代码中调用

#include 

需要配置cmake,如下。工程名称为test,需要替换,主源代码为main.cpp

cmake_minimum_required(VERSION 3.14)
project(test)

find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})

find_package(GLUT REQUIRED)
include_directories(${GLUT_INCLUDE_DIR})

set(CMAKE_CXX_STANDARD 14)

add_executable(test main.cpp)
target_link_libraries(test ${GLUT_LIBRARY} ${OPENGL_LIBRARY})

安装OpenGL

sudo apt-get install build-essential libgl1-mesa-dev
sudo apt-get install freeglut3-dev
sudo apt-get install libglew-dev libsdl2-dev libsdl2-image-dev libglm-dev libfreetype6-dev

你可能感兴趣的:(Ubuntu Clion 配置OpenGL)