[英]I am having trouble compiling and running my C program. What are the commands?
I am having trouble compiling and running my C program. 我在编译和运行C程序时遇到问题。 What are the commands?
命令是什么?
My code is: 我的代码是:
#include <stdio.h>
int main(){
printf("Hello World!\n");
exit(0);
}
I tried compiling with 我尝试用
gcc -o hello.c
only to be unsuccessful. 只是不成功。 I am using a Mac terminal, if that matters.
如果这很重要,我正在使用Mac终端。
In gcc
, option -o
is used to specify a custom output filename. 在
gcc
,选项-o
用于指定自定义输出文件名。 The immediate next argument should be the file name. 下一个直接参数应该是文件名。
-o file
Place output in file file.
将输出放置在文件文件中。 This applies to whatever sort of output is being produced, whether it be an executable file, an object file, an assembler file or preprocessed C code.
这适用于所产生的任何类型的输出,无论是可执行文件,目标文件,汇编文件还是预处理的C代码。
A simple revised command will be 一个简单的修订命令将是
gcc -o hello hello.c
where, hello
is the name of the binary. 其中,
hello
是二进制文件的名称。
You can check the online gcc manual for more info. 您可以查看在线gcc手册以获取更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.