简体   繁体   中英

I use Cmake to make project, but it called error when generating : Target "xxxxxxx" links to: igl::core , but the target was not found

Configuring done
CMake Error at CMakeLists.txt:5 (target_link_libraries):
  Target "101_GlyphRendering_bin" links to:

    igl::core

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Here is my CMakeLists.txt :

cmake_minimum_required(VERSION 3.16)
project(101_GlyphRendering)

add_executable(${PROJECT_NAME}_bin main.cpp)
target_link_libraries(${PROJECT_NAME}_bin PUBLIC igl::core igl::glfw igl::opengl tutorials)

I opened the project and built it, an error occurred:

C1083 Cannot open include file:'directional/directional_viewer.h':No such file or dictory

enter image description here

I'm not sure what exactly is your problem, but speaking of

C1083 Cannot open include file:'directional/directional_viewer.h':No such file or directory

If you want to manually link libraries, you need to also include headers from that libraries. To do such, use

target_include_directories(<target> PUBLIC <include_folder_dir>)

where <target> is your ${PROJECT_NAME}_bin and <include_folder_dir> is folder with headers of library you are linking to.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM