用gcc编译C程序;无法打开输出文件_.exe:没有这样的文件或目录 [英] compiling C program with gcc; Cannot open output file _.exe: no such file or directory

查看:292
本文介绍了用gcc编译C程序;无法打开输出文件_.exe:没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始尝试用C语言编程,并且下载了各种IDE和编译器,但似乎没有任何效果.当我尝试编译程序时,Cygwin一直给我这个错误:

I just started trying to program in C and I've downloaded all kinds of IDE's and compilers and nothing seems to be working. Cygwin keeps giving me this error when i try to compile my program:

C:\Users\Paul\Documents\Timmy
λ gcc -o nutt nutt.c
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: 
cannot open output file nutt.exe: No such file or directory
collect2: error: ld returned 1 exit status.

这是我的程序

#include <stdio.h>
int main(void) {
    printf("y");
    return 0;
}

我还想指出,当我尝试在记事本或notepad ++中使用另存为"功能时,我遇到了一个奇怪的问题.当我尝试以这种方式保存某些内容时,它会弹出一条错误消息,提示找不到文件,并检查文件名并重试.这两个问题似乎都是在同一时间发生的,我不确定它们是否相关.我尝试通过将文件类型设置为所有类型来保存这种方式,而我只是输入"something.c"作为名称.

I also want to point out that i have this strange issue when i try to use the "save as" features in notepad or notepad++. when i try to save something this way it will bring up an error message saying the file isn't found and to check the file name and try again. both of these issues seem to have occured around the same time, i'm not sure if they are related. I try saving this way by setting the file type to all types and i just type in "something.c" for the name.

推荐答案

我已修复它!谢谢你们的帮助.我通过关闭Windows Defender安全中心中的受控文件夹访问来解决此问题.

I fixed it! thank you guys for trying to help. I fixed it by turning off controlled folder access in my windows defender security center.

我现在可以使用另存为功能并编译我的C源文件.

I can now use the save as features and compile my C source files.

当窗口确实是我的错时,我一直在尝试搜索有关gcc的信息...

I kept trying to google stuff about gcc when it was really window's fault...

这篇关于用gcc编译C程序;无法打开输出文件_.exe:没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆