Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个用 C 语言编写的 .c 文件,它调用一个在 .s 文件中用汇编语言编写的函数。
如何从这两个创建可执行文件?我知道我必须使用标志 -o,但由于某种原因,它没有按我的预期工作。
只需在命令行上指定所有文件。Gcc 通过查看文件扩展名知道如何处理它们。
gcc file1.c file2.s -o foo
应该可以解决问题,除非您忘记向我们提供有关要链接哪些其他库的更多信息。