0

I've been trying to add a shared library that I created to an other program. When I try to include header file from the library in the main.cpp, the Clion can't find the file.

This is the CMakeLists.txt:

cmake_minimum_required(VERSION 3.25)
project(program_1)


set(CMAKE_CXX_STANDARD 17)


link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../shared_library)
link_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_executable(program_1 main.cpp)


target_link_libraries(program_1 shared_library)


install(TARGETS program_1 DESTINATION bin)
install(FILES libshared_library.so DESTINATION lib)

Note:No errors when I build this project in CLion

I tried to use chatGPT and other questions in stack overflow, didn't come up with a solution.

  • If you are trying to *include* a file and your compiler doesn't know in which *directory* to look for it, perhaps try messing around with `include_directories`? I'd give it a a try. – n. m. could be an AI Apr 23 '23 at 15:10

0 Answers0