Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding GTK library to CLion

Tags:

clion

gtk3

I'm new to GTK and I'm using CLion IDE to code. I'm on Ubuntu and I've installed libgtk-3.0-dev . The headers I've added to my code is:

gtk-3.0

gtk-3.0/gtk/gtk.h

but when I want to build the project I get this error :

fatal error: gtk-3.0: No such file or directory

like image 891
AmirAhmad Avatar asked Jul 02 '15 10:07

AmirAhmad


1 Answers

I edited the CMakeLists file as as mentioned here and it worked.

Here is my CMakelists.txt:

cmake_minimum_required(VERSION 3.3)
project(gtk_test)

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

set(SOURCE_FILES main.cpp)
add_executable(gtk_test ${SOURCE_FILES})

find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)

include_directories(${GTK3_INCLUDE_DIRS})
link_directories(${GTK3_LIBRARY_DIRS})

add_definitions(${GTK3_CFLAGS_OTHER})

target_link_libraries(gtk_test ${GTK3_LIBRARIES})

I'm using Clion 2016 and libgtk-3.0-dev on Ubuntu 15.04.

like image 119
arnaud Avatar answered Sep 17 '22 21:09

arnaud