nb1232 2022-01-13 21:39 采纳率: 100%
浏览 48
已结题

在学习c++ 写一个小项目练习,我写完第一个函数后cmake编译后没有问题,之后又写了第二个函数 再次cmake时报错,如何解决?

问题遇到的现象和发生背景
在学习c++ 写一个小项目练习,我写完第一个函数后cmake编译后没有问题,之后又写了第二个函数 再次cmake时报错

报错内容如下
PS D:\myvscode\vscode-code\cpptest1\build> mingw32-make
Consolidate compiler generated dependencies of target main
[ 25%] Building CXX object CMakeFiles/main.dir/src/Menu.cpp.obj
[ 50%] Linking CXX executable ..\bin\main.exe
D:/myvscode/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot open output file ..\bin\main.exe: Pe: Permission denied
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [CMakeFiles\main.dir\build.make:133: ../bin/main.exe] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:82: CMakeFiles/main.dir/all] Error 2
mingw32-make: *** [Makefile:90: all] Error 2

img

img

img

希望可以得到解答 我怎样操作才不会报错

  • 写回答

2条回答 默认 最新

  • _GX_ 2022-01-13 22:21
    关注

    你的main.exe还在运行,你得把它退出/结束后,cmake才能重新编译生成新的main.exe

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 1月21日
  • 已采纳回答 1月13日
  • 修改了问题 1月13日
  • 创建了问题 1月13日

悬赏问题

  • ¥15 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥15 DruidDataSource一直closing
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据