Related to this question。编译C程序的过程是什么(假设1个文件)?编译C程序有多容易?
回答
报价http://users.actcom.co.il/~choo/lupg/tutorials/c-on-unix/c-on-unix.html:
编译最简单的情况是,当你在一个single file设置的所有源代码。
cc single_main.c
你会抱怨“的a.out”是一个过于笼统的名称(如它从何而来呢? - 好,这是一个历史名称,由于一些所谓的使用“一.out格式“用于旧版Unix系统上编译的程序)。假设你想把结果程序称为“single_main”。在这种情况下,你可以使用以下行来编译:
cc single_main.c -o single_main
“cc”?我们是在五十年代吗? – 2010-01-03 13:46:36
好吧,现在它通常会是一个符号链接,我猜... FreeBSD上的 – miku 2010-01-03 13:48:35
,'/ usr/bin/cc'与'/ usr/bin/gcc'和'/ usr/bin/C++'与'/ usr/bin/g ++'(硬链接)文件相同。 FreeBSD 8附带'(GCC)4.2.1 20070719' – 2010-01-03 18:08:58
这取决于什么编译器/ IDE使用。
随着Visual Studio ctrl-shift-B
是你所需要建立你的项目。
使用gcc在命令行输入:gcc file.c -o executable_name
。
NAME
gcc - GNU project C and C++ compiler
SYNOPSIS
gcc [-c|-S|-E] [-std=standard]
[-g] [-pg] [-Olevel]
[-Wwarn...] [-pedantic]
[-Idir...] [-Ldir...]
[-Dmacro[=defn]...] [-Umacro]
[-foption...] [-mmachine-option...]
[-o outfile] [@file] infile...
Only the most useful options are listed here; see below for the remain-
der. g++ accepts mostly the same options as gcc.
DESCRIPTION
When you invoke GCC, it normally does preprocessing, compilation,
assembly and linking. [...]
- 1. 如何编译OpenGL C++程序“更容易”?
- 2. C++程序编译
- 3. 编译C++程序
- 4. Makefile可以编译多个C程序?
- 5. Fullcalendar有多容易?
- 6. 编译没有多线程DLL的程序(Visual C++ 2010)
- 7. 程序没有编译的C++问题
- 8. g ++没有编译我的C++程序
- 9. C++程序编译没有参考主
- 10. C程序编译但没有输出
- 11. C程序不编译
- 12. C程序编译错误
- 13. 编译继承程序C++
- 14. C程序分步编译
- 15. C#编译Visual Studio程序
- 16. C++程序无法编译
- 17. C程序编译错误
- 18. 无法编译C程序
- 19. 如何编译C程序?
- 20. 运行定制XMPP服务器应用程序有多容易?
- 21. 程序编译有错误
- 22. 在Objective-C编译器上编译不正确的C程序
- 23. 有没有办法从python编译c/C++程序?
- 24. 如何在C中编译C程序?
- 25. 编译C++函数C++程序
- 26. C++:错误而C++程序编译
- 27. C++多文件编译过程
- 28. 易C程序错误
- 29. java btc贸易应用程序编译时错误(HTTP组件)
- 30. 编译与intel编译器icpc在linux的C++程序
您是否正在谈论编译C文件时需要做什么或编译C文件(预处理器,编译器,链接器等)时幕后发生了什么? – 2010-01-03 13:55:12