S
S
Sour_Lemon2021-08-10 11:44:50
OpenGL
Sour_Lemon, 2021-08-10 11:44:50

How to connect glad to a project in qt creator?

Good afternoon. I'm trying to start learning opengl, but not yet. I need to include the glad ( ) library in a qt creator project. This library consists of a couple of headers and one .c file.
All my attempts lead to errors like

:-1: error: glad.o: undefined reference to symbol '[email protected]@GLIBC_2.2.5'
or
error: undefined reference to `gladLoadGLLoader'
(gladLoadGLLoader is the glad function). It seems to me that the compiler does not see the implementation of the header files, but this is not certain. I work on manjaro linux.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sour_Lemon, 2021-08-10
@Sour_Lemon

Solution: Here is my CMakeLists

cmake_minimum_required(VERSION 3.5)

project(untitl LANGUAGES CXX C)

add_executable(untitl main.cpp glad.c)


find_package(glfw3 3.3 REQUIRED)
find_package(OpenGL REQUIRED)

target_include_directories(untitl PUBLIC
                           $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
                           $<INSTALL_INTERFACE:include>)
target_link_libraries(untitl PUBLIC glfw OpenGL::GL ${CMAKE_DL_LIBS})

The essence of the problem, as it turned out, is here: project(untitl LANGUAGES CXX C)
You need to add another C language and then everything will work

A
Alexander Ananiev, 2021-08-10
@SaNNy32

You need to add a link with the libdl library
https://stackoverflow.com/questions/56841870/how-t...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question