问题遇到的现象和发生背景
我在使用windows环境下的clion上去安装密码学的miracle库,提示
undefined reference to `mirsys'
D:\CLion 2022.1.3\bin\mingw\bin/ld.exe: F:/sm9pro/test.c:12: undefined reference to `mirvar'
D:\CLion 2022.1.3\bin\mingw\bin/ld.exe: F:/sm9pro/test.c:14: undefined reference to `cotnum'
D:\CLion 2022.1.3\bin\mingw\bin/ld.exe: F:/sm9pro/test.c:15: undefined reference to `cinnum'
D:\CLion 2022.1.3\bin\mingw\bin/ld.exe: F:/sm9pro/test.c:16: undefined reference to `cotnum'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
用代码块功能插入代码,请勿粘贴截图
cmake代码是这样的
cmake_minimum_required(VERSION 3.20)
project(sm9pro)
include_directories(miracl/include/miracl)
link_directories(miracl/lib)
add_executable(test test.c)
target_link_directories(test PUBLIC glut32.lib miracl.h mirdef.h)
运行结果及报错内容
undefined reference to `mirsys'
D:\CLion 2022.1.3\bin\mingw\bin/ld.exe: F:/sm9pro/test.c:12: undefined reference to `mirvar'
D:\CLion 2022.1.3\bin\mingw\bin/ld.exe: F:/sm9pro/test.c:14: undefined reference to `cotnum'
D:\CLion 2022.1.3\bin\mingw\bin/ld.exe: F:/sm9pro/test.c:15: undefined reference to `cinnum'
D:\CLion 2022.1.3\bin\mingw\bin/ld.exe: F:/sm9pro/test.c:16: undefined reference to `cotnum'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
我的解答思路和尝试过的方法
我把这些lib h文件移植到vs2022上面去就可以正常运行
我想要达到的结果
可以在clion上使用miracl库