jeudi 1 septembre 2016

CMake linking opengl lib error

i'm working with CLion, and I'm writing a program using the openGL lib.(https://www.opengl.org/)

I installed and did everything correctly for openGL i have the .a and .h files in:

/usr/local/lib/libglfw3.a

/usr/local/include/.h(all files)

I'm trying to use the library now, but i'm getting the linker error:

undefined reference to 'glViewport' etc. etc. all the functions i'm using

I added the lib path to the make file, I can't understand what i'm doing wrong, my CMakeLists.txt looks like this:

cmake_minimum_required(VERSION 3.6)
project(testing)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

set(SOURCE_FILES main.cpp examples.h)

add_executable(testing ${SOURCE_FILES})
target_link_libraries(testing /usr/local/lib/libglfw3.a)
target_link_libraries(testing /usr/local/lib/libTest.a)

target_link_libraries(testing pthread)

any help will be appreciated.

Thanks!

Aucun commentaire:

Enregistrer un commentaire