0
votes

I'm trying to find SQLiteCpp using this CMakeLists.txt on Ubuntu 17.04 64bit.

# CMakeLists.txt
cmake_minimum_required(VERSION 3.7)
project(shule)

find_package(SQLiteCpp CONFIG REQUIRED)
include_directories(${SQLITECPP_INCLUDE_DIR})

set(SOURCE src/main.cpp)

add_executable(shule ${SOURCE})
target_link_libraries(shule SQLiteCpp)

The SQLiteCpp is installed under 'usr/local/lib' with the name 'libSQLiteCpp.a' and its CMake scripts, 'SQLiteCppConfig.cmake' and 'SQLiteCppConfig-noconfig.cmake', are installed under 'usr/local/lib/cmake/SQLiteCpp'. The include files are installed under 'usr/local/include/SQLiteCpp'`. I'm trying to compile the following simple file.

#include <iostream>
#include <string>

#include <SQLiteCpp.h>


int main(int argc, char** argv)
{
    std::cout << "Database" << std::endl;
    return 0;
}

I get the error message SQLiteCpp.h: No such file or directory #include . What am I missing?

1
Try #include <SQLiteCpp/SQLiteCpp.h>Russley Shaw
Aren't all the includes for SQLiteCPP nested, so you have to include <SQLiteCPP/SQLiteCPP.h>?Alexander Huszagh

1 Answers

2
votes

If your header file is located in usr/local/include/SQLiteCpp, most likely usr/local/include is in your $PATH. Make sure to include the subdirectory.

#include <SQLiteCpp/SQLiteCpp.h>