编译C源$ C ​​$ C没有一个主要功能 [英] compiling c source code without a main function

查看:105
本文介绍了编译C源$ C ​​$ C没有一个主要功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何可以编译我的C源文件,而无需将在其中一个主要功能?

How can I compile my c source files without needing to put a main function within them?

我得到那些没有主函数和不要的.c文件的错误希望有添加的主要功能只是编译。

I get an error for the .c files that have no main function and dont want to have to add a main function just for compilation.

推荐答案

什么是你的编译器?

在GCC中, -c 开关是你想要的( -c 表示编译,不该做什么链接,你会得到一个 name.o 输出文件)。

On GCC, the -c switch is what you want (-c means "compile, don't link" and you get an name.o output file).

这篇关于编译C源$ C ​​$ C没有一个主要功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆