开源的c/c++编译器 mingm 编译、执行一段简单的c/c++代码
来源:互联网 发布:windows预览体验版 编辑:程序博客网 时间:2024/05/21 10:39
<pre name="code" class="html">MinGW, a contraction of "Minimalist GNU for Windows", is a minimalist development environment for native Microsoft Windows applications.MinGW provides a complete Open Source programming tool set which is suitable for the development of native MS-Windows applications, and which do not depend on any 3rd-party C-Runtime DLLs. (It does depend on a number of DLLs provided by Microsoft themselves, as components of the operating system; most notable among these is MSVCRT.DLL, the Microsoft C runtime library. Additionally, threaded applications must ship with a freely distributable thread support DLL, provided as part of MinGW itself).MinGW compilers provide access to the functionality of the Microsoft C runtime and some language-specific runtimes. MinGW, being Minimalist, does not, and never will, attempt to provide a POSIX runtime environment for POSIX application deployment on MS-Windows. If you want POSIX application deployment on this platform, please consider Cygwin instead.Primarily intended for use by developers working on the native MS-Windows platform, but also available for cross-hosted use, (see note below -- you may need to follow the "read more" link to see it), MinGW includes:A port of the GNU Compiler Collection (GCC), including C, C++, ADA and Fortran compilers;GNU Binutils for Windows (assembler, linker, archive manager)A command-line installer, with optional GUI front-end, (mingw-get) for MinGW and MSYS deployment on MS-WindowsA GUI first-time setup tool (mingw-get-setup), to get you up and running with mingw-get.
1.下载路径:http://sourceforge.net/projects/mingw/files/latest/download?source=files
2. 运行mingw-get-setup.exe之后,一步一步,会打开一个graphic management installer,选择需要安装的compiler。
也可以通过命令行来安装:
2.1 把安装目录下的bin添加到path环境变量下。
2.2
mingw-get install gcc g++ mingw32-make 会安装c/c++编译器和mingw32-make
3. 在D:\python\workspace有一个文件test.c 是一段简单的c代码:
#include <stdio.h>void main() { printf("Hello World!\n");printf("total num is %d",count(10,20));}int count(int a,int b){printf("value of a is %d, value of b is %d \n",a,b);return a+b;}3.1编译test.c成test.o
cd到workspace目录下:gcc -c test.c
【3.2.1】把test.o编译成可执行二进制文件test.exe
gcc -o test test.o
【3.2.2】
也可以一个命令实现1/2两步:
gcc test.c -o test
3.3 运行test.exe
在命令行:test
输出结果为:
D:\python\workspace\cTestProject>testHello World!value of a is 10, value of b is 20total num is 30
0 0
- 开源的c/c++编译器 mingm 编译、执行一段简单的c/c++代码
- 简单的C编译器
- 一段经典的c代码
- 【c语言基础必备】gcc编译器的简单编译
- C、C++、C#简单代码编译结果的不同!
- 一段经典的c
- ASP.NET(C#) 定时执行一段代码
- 一段简单的C/C++病毒源程序
- 一段简单的C反汇编
- 一段找出URL的代码(C#)
- 一段C语言写的病毒代码
- 一段搜索地址的C代码【原】
- 解析csv格式文件的一段C代码
- 关于+—~有意思的一段C代码
- 一段导致栈耗尽的C代码
- C编译执行的过程
- C编译器的八个编译阶段
- C语言的编译器及编译过程
- 猫猫学iOS 之CoreLocation指南针小应用
- 记录一些matlab中关于文件路径的操作
- 在做java 的web开发,为什么要使用框架
- iOS APP瘦身技巧之第三方SDK瘦身
- web form
- 开源的c/c++编译器 mingm 编译、执行一段简单的c/c++代码
- HDU 1026(优先队列+BFS+前驱记录)
- 【C#】27. 比较工具EXCEL Addin
- Android Api Demos登顶之路(四十三)Fragment-->Retain Instance
- [C语言][LeetCode][169]Majority Element
- springmvc学习笔记(六)注解优化
- 加法乘法原理、排列组合、线性规划
- MySql中用一张表的数据更新另一张表的部分数据
- android -------个人中心界面UI的实现。