Windws-X64 安装GCC
来源:互联网 发布:hf线切割编程软件 编辑:程序博客网 时间:2024/06/08 05:43
gcc for Windows
Introduction
Most Unix and Linux users know the GNU Compiler Collection (gcc). This software compiler system is being used to build a lot of software, including modern operating systems such as Linux and BSD, which means it is well tested and maintained. Additionally, gcc is available under GPL v3 – the most popular free software license. This gives everyone the right to examine and modify its source code and also download it free of charge.
gcc can provide many benefits to developers targeting the Windows platform. In contrary to Visual Studio and most other compiler tools for Windows, gcc is Open Source Software completely free of charge and supported by a large community. Projects targeting multiple operating systems will also save time by using just one compiler system, and if you already know gcc you don’t have to spend time learning new compilers.
Compiling for 64-bit Windows 下载链接 :http://mingw-w64.sourceforge.net/download.php
There are multiple ports of gcc to Windows, but MinGW (Minimalist GNU for Windows) seems to get the most traction. But currently MinGW can only build 32-bit binaries. In order to be able to target both 32-bit (x86) and 64-bit (x64) Windows versions, we will use a flavour of it called MinGW-w64 (aka. mingw64). In addition to the compiler binaries, the package contains headers (e.g. stdlib.h, strings.h, etc.) and libraries necessary to build applications.
Hello World
It is time to get our hands dirty and compile a C-version of Hello World. We will create one for 32-bit Windows and one for 64-bit Windows. The build platform used is a 32-bit Windows XP, but any version of Windows newer than Windows 2000, including Windows Vista and Windows 7 should give the same results. 64-bit versions of Windows will work as well.
- Go to the MinGW-w64 download page. We need two toolchains – one for targeting win32 and another for targeting win64. New packages are frequently uploaded, but we just pick the newest personal build (I had some bad experiences with the automated builds). Open “Toolchains targetting Win32″ and “Toolchains targetting Win64″, followed by “Personal Builds”.
- Unpack the first package to “c:\mingw32″ and the second to “c:\mingw64″.
- Open a text editor (e.g. Notepad), paste in the famous world greeting and save it under “c:\tmp\hello.c”.
#include <stdio.h>
int main(){ printf("Hello World!\n"); return 0;}
- Open a Command Prompt, cd to “c:\tmp” and compile with the following commands. See the related cross-compilation post for an explanation of the compiler names.
"c:\mingw32\bin\i686-w64-mingw32-gcc.exe hello.c -ohello-w32.exe"
"c:\mingw64\bin\x86_64-w64-mingw32-gcc.exe hello.c -ohello-w64.exe"
- On 32-bit windows (aka. x86), you can only run “hello-w32.exe”, while you can actually run both on 64-bit Windows (aka. x64) because of an emulation layer called Windows 32-bit On Windows 64-bit. It is however much more efficient to run native binaries, that is, “hello-w64.exe” on 64-bit Windows versions.
Build Environment
When building larger projects, we usually want a Unix-like shell in order to run additional tools like configure, make and automake. On Windows, we can use MSYS (Minimal SYStem) to get a shell and the basic commands often used in build-scripts, like grep and sed. This means we can compile code on Windows that will run on Windows, which seems like the natural way to go.
However, note that with the MinGW-w64 suite, it is possible to compile code on Linux that will run on Windows. This is also known as cross-compilation, and will greatly increase the build speed but also allow to use any native Linux shell, rendering MSYS unnecessary. In another post, we consider how to cross-compile Windows binaries on Linux.
Furthermore, real-world applications depend on common libraries. There is a related article on how to compile and use the OpenSSL library on Windows.
转自:
- Windws-X64 安装GCC
- Windws 服务程序的安装
- 香蕉派SD卡安装系统(Windws平台工具)
- unbuntn X64 安装vsftpd
- windows7 x64 Scrapy安装
- win2003 x64 安装密钥
- Openssl WIN7 x64 安装
- centos7(x64)安装snort
- Win10 x64安装paramiko
- Window10 X64 安装TWinCat3
- Windows8-x64 VMWare安装Linux CentOS6-x64
- GCC、GCC-C++安装
- 安装 gcc
- gcc安装
- gcc安装
- GCC 安装
- GCC 安装
- 安装GCC
- erlang OTP设计原理文档
- excel VBA学习
- TCP/IP详解学习笔记(9)-TCP协议概述
- 关于json 的使用
- iOS 开发之 UIView
- Windws-X64 安装GCC
- <mvc:annotation-driven />注解意义
- TCP/IP详解学习笔记(10)-TCP连接的建立与中止
- Android学习启动篇
- DevExpress控件使用之RichEditControl的使用
- POJ1988——Cube Stacking
- 嵌入式 (unix domain socket本地套接字)使用udp发送>=128K的消息会报ENOBUFS的错误
- [NOIP 2014复习]疑难题记录
- 代码生成器 CodeSmith 的使用(一)