У меня возникли некоторые проблемы с добавлением внешней библиотеки в мой проект в CLion, и все, что я нашел по этой теме, на самом деле не дало мне дальнейшего развития.
Я добавил эти файлы:
include/curses.h
include/panel.h
lib/pdcurses.lib
cmake-build-debug/pdcurses.dll
Я также добавил файлы в свою папку MinGW на случай, если кто-нибудь там заглянет … Да, я заблудился.
Как мой CMakeLists.txt должен искать это? Попробовал так много, но так как я действительно понятия не имею о cmake, я не могу заставить его работать.
в настоящее время это выглядит так
cmake_minimum_required(VERSION 3.6)
project(113_curses)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lpdcurses")
set(SOURCE_FILES main.cpp)
add_executable(113_curses ${SOURCE_FILES})
include_directories(${MY_SOURCE_DIR}/include)
link_directories(${MY_SOURCE_DIR}/lib)
target_link_libraries(113_curses pdcurses.lib)
Ошибки
[ 50%] Linking CXX executable 113_curses.exe
C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../lib/pdcurses.lib when searching for -lpdcurses
C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../pdcurses.lib when searching for -lpdcurses
C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../lib/pdcurses.lib when searching for -lpdcurses
C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../lib\pdcurses.lib when searching for -lpdcurses
C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../pdcurses.lib when searching for -lpdcurses
C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../..\pdcurses.lib when searching for -lpdcurses
C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lpdcurses
C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../lib/pdcurses.lib when searching for -lpdcurses
C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../pdcurses.lib when searching for -lpdcurses
C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../lib/pdcurses.lib when searching for -lpdcurses
C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../lib\pdcurses.lib when searching for -lpdcurses
C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../pdcurses.lib when searching for -lpdcurses
C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../..\pdcurses.lib when searching for -lpdcurses
C:/Tools/mingw-w64/x86_64-6.3.0-win32-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lpdcurses
collect2.exe: error: ld returned 1 exit status
CMakeFiles\113_curses.dir\build.make:96: recipe for target '113_curses.exe' failed
CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/113_curses.dir/all' failed
mingw32-make.exe[2]: *** [113_curses.exe] Error 1
Makefile:82: recipe for target 'all' failed
mingw32-make.exe[1]: *** [CMakeFiles/113_curses.dir/all] Error 2
mingw32-make.exe: *** [all] Error 2
Вам нужно добавить:
include_directories(/path/to/curses/include)
Других решений пока нет …