Raj*_*eev 2 c linux compiler-construction
在linux盒子上
是否必须将程序写入文件并进行编译
这不能通过命令行完成
localhost$gcc "include<stdio.h> int main(){printf('hello world'); return o; }"
Run Code Online (Sandbox Code Playgroud)
确定你可以,但我怀疑这是有道理的....
$ echo '#include <stdio.h>
int main() { printf("hello world\n"); return 0; }' | gcc -x c -
$ ./a.out
hello world
$
Run Code Online (Sandbox Code Playgroud)
gcc选项:
-o <file> Place the output into <file>
-x <language> Specify the language of the following input files
Permissible languages include: c c++ assembler none
'none' means revert to the default behavior of
guessing the language based on the file's extension
Run Code Online (Sandbox Code Playgroud)