【发布时间】:2018-11-23 09:09:47
【问题描述】:
最近我获得了“curses.h”并构建了 PDCurses“pdcurses.a”库文件,这要归功于: https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-pdcurses 包裹。我还准备了cmake文件:
# pdcurses-config.cmake
set(PDCURSES_LIBDIR "${PROJECT_SOURCE_DIR}/lib")
set(PDCURSES_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src/include")
set(PDCURSES_LIBRARIES "-L${PDCURSES_LIBDIR} -lpdcurses -static -Wall -Werror")
string(STRIP "${PDCURSES_LIBRARIES}" PDCURSES_LIBRARIES)
# CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project(MatrixAlgebra)
set(CMAKE_CXX_STANDARD 11)
set(PDCURSES_DIR "${PROJECT_SOURCE_DIR}/cmake")
find_package(PDCURSES REQUIRED)
include_directories(${PDCURSES_INCLUDE_DIRS})
set(SOURCE_FILES src/main.cpp)
add_executable(MatrixAlgebra ${SOURCE_FILES})
target_link_libraries(MatrixAlgebra ${PDCURSES_LIBRARIES})
很遗憾,我无法链接一个简单的“Hello World!”控制台程序,因为要么我得到这个:
mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe:找不到-lpdcurses collect2.exe:错误:ld 返回 1 退出状态 mingw32-make.exe[3]: * [CMakeFiles\MatrixAlgebra.dir\build.make:97: MatrixAlgebra.exe] 错误 1 mingw32-make.exe[2]: [CMakeFiles\Makefile2:67: CMakeFiles/MatrixAlgebra.dir/all] 错误 2 mingw32-make.exe[1]: [CMakeFiles\Makefile2:79: CMakeFiles/MatrixAlgebra.dir/rule] 错误 2 mingw32-make.exe: * [Makefile:117: MatrixAlgebra] 错误 2
或者这个(当我将“pdcurses.a”更改为“libpdcurses.a”时):
进程以退出代码 -1073741515 (0xC0000135) 结束
我只是不知道该怎么做才能让它顺利进行。
【问题讨论】:
标签: c++ cmake 64-bit clion pdcurses