2011-06-08 101 views
2

迄今为止,我对C/C++编程语言的新增内容已经使用Code :: blocks程序来编写和编译程序。不过,我需要知道如何通过Windows命令提示编译程序,因为我需要访问创建的汇编代码。我的编译器是mingw32-gcc.exe,mingw32-g ++ .exe如何通过Windows命令提示符编译C/C++程序?

+1

参考Oracle第一运行程序(即5秒谷歌搜索:http://www.mingw.org/wiki/MinGW_for_First_Time_Users_HOWTO) – AJG85 2011-06-08 15:48:42

回答

3

请阅读Compile Programs with MinGW -- A Guide for New Users。 为了使gcc,产生汇编代码,使用-S选项:

-S Stop after the stage of compilation proper; do not assemble. The output is in the form of an assembler code file for each non-assembler input file specified. 

     By default, the assembler file name for a source file is made by replacing the suffix .c, .i, etc., with .s. 

     Input files that don't require compilation are ignored. 

祝你好运!

+0

谢谢,设置为PATH MinGW的\ bin中需要在命令行之前的环境变量中。 – 2011-06-08 16:37:42

1

,如果你有MinGW的安装为gcc编译然后按照下列步骤

  1. 右键点击我的电脑代码块 - >进入属性 - >高级系统设置
  2. 然后让一个名为的环境变量路径并粘贴完整的URL,如程序文件(x86)/ codeblocks/mingw/bin。
  3. 现在打开cmd
  4. 转到保存程序的目录。
  5. 键入gcc program_name.c -o program_name.exe来编译程序。
  6. 通过键入程序名
相关问题