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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With