Skip to content

Latest commit

 

History

History
21 lines (13 loc) · 488 Bytes

specify-language.md

File metadata and controls

21 lines (13 loc) · 488 Bytes

指定语言类型

技巧

gcc是通过文件名后缀来判断源代码语言类型的。

如果你从标准输入把源码传给gcc,那么就需要通过-x选项显式的指定语言类型:

$ echo "int x;" | gcc -S -x c -
$ cat ./-.s
	.file	""
	.comm	x,4,4
	.ident	"GCC: (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3"
	.section	.note.GNU-stack,"",@progbits

详情参见gcc手册

贡献者

xmj