cannot find -lmsvcrt

本文详细介绍了在64位操作系统下,使用MinGW编译C程序时遇到cannot find lmsvcrt错误的解决方案。通过下载并配置mingw-w64,安装后将bin目录添加到PATH环境变量中,并重命名mingw32-make.exe为make.exe,即可成功使用makefile编译C程序。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

当我在64位操作系统上使用MinGW的 -m32选项编译C程序时,报错:

cannot find -lmsvcrt

解决方案,下载同时支持32bit和64bit的mingw-w64,按照下图配置安装
这里写图片描述
安装后将bin目录添加到 path环境变量中,并且在bin中将mingw32-make.exe重命名为make.exe
然后就可以使用makefile编译C程序了
这里写图片描述

gcc.exe D:\代码\main.c -o main D:\应用\CLion 2024.1.4\bin\mingw\bin/ld.exe: cannot find D:/应用/CLion 2024.1.4/bin/mingw/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o: No such file or directory D:\应用\CLion 2024.1.4\bin\mingw\bin/ld.exe: cannot find D:/应用/CLion 2024.1.4/bin/mingw/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/crtbegin.o: No such file or directory D:\应用\CLion 2024.1.4\bin\mingw\bin/ld.exe: cannot find -lmingw32: No such file or directory D:\应用\CLion 2024.1.4\bin\mingw\bin/ld.exe: cannot find -lgcc: No such file or directory D:\应用\CLion 2024.1.4\bin\mingw\bin/ld.exe: cannot find -lgcc_eh: No such file or directory D:\应用\CLion 2024.1.4\bin\mingw\bin/ld.exe: cannot find -lmoldname: No such file or directory D:\应用\CLion 2024.1.4\bin\mingw\bin/ld.exe: cannot find -lmingwex: No such file or directory D:\应用\CLion 2024.1.4\bin\mingw\bin/ld.exe: cannot find -lmsvcrt: No such file or directory D:\应用\CLion 2024.1.4\bin\mingw\bin/ld.exe: cannot find -lkernel32: No such file or directory D:\应用\CLion 2024.1.4\bin\mingw\bin/ld.exe: cannot find -lpthread: No such file or directory D:\应用\CLion 2024.1.4\bin\mingw\bin/ld.exe: cannot find -ladvapi32: No such file or directory D:\应用\CLion 2024.1.4\bin\mingw\bin/ld.exe: cannot find -lshell32: No such file or directory D:\应用\CLion 2024.1.4\bin\mingw\bin/ld.exe: cannot find -luser32: No such file or directory D:\应用\CLion 2024.1.4\bin\mingw\bin/ld.exe: cannot find -lkernel32: No such file or directory D:\应用\CLion 2024.1.4\bin\mingw\bin/ld.exe: cannot find -liconv: No such file or directory D:\应用\CLion 2024.1.4\bin\mingw\bin/ld.exe: cannot find -lmingw32: No such file or directory D:\应用\CLion 2024.1.4\bin\mingw\bin/ld.exe: cannot find -lgcc: No such file or directory D:\应用\CLion 2024.1.4\bin\mingw\bin/ld.exe: cannot find -lgcc_eh: No such file or directory D:\应用\CLion 2024.1.4\bin\mingw\bin/ld.exe: cannot find -lmoldname: No such file or directory D:\应用\CLion 2024.1.4\bin\mingw\bin/ld.exe: canno
最新发布
03-17
[Running] cd "c:\Users\wangjiahao\Desktop\VScode\" && g++ hello.cpp -o hello && "c:\Users\wangjiahao\Desktop\VScode\"hello D:/浏览器/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find D:/浏览器/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o: Invalid argument D:/浏览器/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find D:/浏览器/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/crtbegin.o: Invalid argument D:/浏览器/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lstdc++: No such file or directory D:/浏览器/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmingw32: No such file or directory D:/浏览器/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgcc: No such file or directory D:/浏览器/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmoldname: No such file or directory D:/浏览器/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmingwex: No such file or directory D:/浏览器/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmsvcrt: No such file or directory D:/浏览器/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lkernel32: No such file or directory D:/浏览器/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lpthread: No such file or directory D:/浏览器/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ladvapi32: No such file or directory D:/浏览器/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lshell32: No such file or director
03-15
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值