c - C-bash的第一个程序: ./: is a directory

标签 c compiler-errors

我在vim中用C编写了一个简短的第一个程序。

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
                        ^^^^^^^^^^^^
终端将./解释为目录。

关于c - C-bash的第一个程序: ./: is a directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63559729/

相关文章:

c - 相对于调用它的源文件映射宏

c - 将 CSV 字符串导入到 C 中的多维数组中

java - 为什么下面的java语句可以编译成功?

c# - 如何委托(delegate)正确的 Action<Interface>?

c++ - 在基于数组的程序中获取最后一个字符串或最后一个价格后,程序崩溃/停止

android - 找不到 *.apk 错误

android - 从 C 代码发送广播

c - 测试 "pthread_create"功能行为

compiler-errors - 未使用属性 'explicit_arity'

c - : main(){}, int main(){} 和 int main(void){} 有什么区别