i get this error fatal error: Scintilla.h: No such file or directory when loading scintilla library

188 views Asked by At

I cloned scintilla from here https://github.com/mirror/scintilla i have built scintilla GTK+/Linux version and scintilla.a is now generated in bin folder.I addressed this library in my CMAkeList.txt file , but when i build my app, i get this error "fatal error: Scintilla.h: No such file or directory" [build] 4 | #include <Scintilla.h>

So i do not know why it can not find scintilla.h...Should i add something more to my cmakelists.txt file?...When i include this line include_directories(${CMAKE_CURRENT_SOURCE_DIR}/scintilla/include) , i get a bunch of new errors such as:

/home/sob/.landscape/ScintillaExample/main.cpp:17:5: error: ‘ScintillaObject’ was not declared in this scope
[build]    17 |     ScintillaObject* sci;
[build]       |     ^~~~~~~~~~~~~~~
[build] /home/sob/.landscape/ScintillaExample/main.cpp:17:22: error: ‘sci’ was not declared in this scope
[build]    17 |     ScintillaObject* sci;

this is how my cmakelists.txt file looks like:

cmake_minimum_required(VERSION 3.1)
project(ScintillaExample) 
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
SET(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)  
SET(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)  
FIND_PACKAGE(PkgConfig REQUIRED)
PKG_CHECK_MODULES(GTK3 REQUIRED gtk+-3.0)
INCLUDE_DIRECTORIES(${GTK3_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/scintilla/bin)
#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/scintilla/include)
add_library(scintilla.a STATIC IMPORTED)
set_property(TARGET scintilla.a PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/scintilla/bin/scintilla.a)
LINK_DIRECTORIES(${GTK3_LIBRARY_DIRS})
#set(SCINTILLA_LIBRARY ${CMAKE_CURRENT_SOURCE_DIR}/scintilla/bin/scintilla.a)
ADD_DEFINITIONS(${GTK3_CFLAGS_OTHER})
ADD_EXECUTABLE(app main.cpp)
TARGET_LINK_LIBRARIES(app ${GTK3_LIBRARIES})

I will be grateful if you could tell me how to solve this problem

1

There are 1 answers

0
sepideh On

I made some changes to my cmakefilelists.txt and it is now working:

cmake_minimum_required(VERSION 3.1)
project(ScintillaExample) 
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
SET(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)  
SET(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)  
FIND_PACKAGE(PkgConfig REQUIRED)
PKG_CHECK_MODULES(GTK3 REQUIRED gtk+-3.0)
INCLUDE_DIRECTORIES(${GTK3_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/scintilla/bin)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/scintilla/include)
LINK_DIRECTORIES(${GTK3_LIBRARY_DIRS})
ADD_DEFINITIONS(${GTK3_CFLAGS_OTHER})
ADD_EXECUTABLE(app main.cpp)
TARGET_LINK_LIBRARIES(app ${CMAKE_CURRENT_SOURCE_DIR}/scintilla/bin/scintilla.a ${GTK3_LIBRARIES} gmodule-2.0)
${CMAKE_CURRENT_SOURCE_DIR}/scintilla/bin/scintilla.a)