我在我的电脑上安装了 MinGWWindows8 笔记本电脑并尝试编译 C 代码文件
gcc test.c -o test.exe
编译器没有给出警告或错误,但没有创建 test.exe
我如何让编译器创建文件
test.c
![test.c](https://i.stack.imgur.com/7C1WR.png)
My terminal session
![this is what i tried on terminal](https://i.stack.imgur.com/cyjm2.png)
一个有趣的观察:
当我故意在代码中引入错误并尝试编译时,编译器显示错误
Code with error
Compiler output
![enter image description here](https://i.stack.imgur.com/VjELo.png)
当我尝试使用命令提示符编译相同的代码时
This is what it shows
![enter image description here](https://i.stack.imgur.com/YsSld.png)
But the file does exist in the MinGW\bin directory
![enter image description here](https://i.stack.imgur.com/R34cs.png)
我移动了
test.c
file to
C:\
并启动命令提示符
C:\MinGW\bin
目录
and here is what it outputs
![enter image description here](https://i.stack.imgur.com/EvEWg.png)
问题部分解决:
我在 Windows 8 中禁用了混合启动并重新启动了计算机。编译器现在可以在命令提示符中运行,但不能在 PowerShell 中运行。
尝试正常编译你的代码
gcc test.c
如果你得到默认输出文件a.exe
,然后去
gcc test.c -o test.exe
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)