gpt4 book ai didi

c++ - 如何将 curses 添加到 cmake?

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:44:18 27 4
gpt4 key购买 nike

我在 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)

关于c++ - 如何将 curses 添加到 cmake?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42328538/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com