问题描述
int main() {
printf("Das ist mein erstes Programm. \n");
return 0;
}
然后我用
进行编译cc -o hello.out hello.c
./ hello.out
昨天我可以在控制台中看到文本“ Das ist mein erstes Programm”。
今天我只看到:
-bash: ./: is a directory
我没有更改代码中的任何内容。有谁知道为什么我现在会“是目录”?
非常感谢
解决方法
尝试使用:
cc -o hello.out hello.c && ./hello.out
您正试图通过在./
和hello.out
之间留一个空格来执行二进制文件:
cc -o hello.out hello.c ./ hello.out
^^^^^^^^^^^^
终端将./
解释为目录。