windows下如何下载g++以及gcc

本文详细介绍了如何在Windows 10系统中下载、安装和配置MinGW,包括通过官方网站下载mingw-get-setup.exe,安装过程中保持网络连接,选择mingw32-gcc-g++进行安装,并将其添加到系统环境变量中。最后,通过CMD验证g++和gcc的版本,确保安装成功。此外,还提供了g++学习教程的链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、下载mingw
点击这个链接可以直接进入下载界面:https://osdn.net/projects/mingw/downloads/68260/mingw-get-setup.exe/
打开后可以直接进入下载界面。
在这里插入图片描述
这个就是下载后的界面。
二、安装mingw
该文件非常小,是因为还需要网络来下载,在安装过程中不能断网。
双击打开出现如下界面
在这里插入图片描述
点击install之后进入界面,默认固定下载,继续点击continue,下载后界面如下:
在这里插入图片描述
在这个界面中找到mingw32-gcc-g+±bin如下
在这里插入图片描述
然后对这个右键点击Mark for installation,只有点击软件左上角installation菜单中的aplly changes开始进入在线下载界面等待下载结束即可。
三、配置环境变量
首先我的电脑是win10。
打开控制面板之后点击系统与安全,再点击系统,左边高级系统设置打开,点击环境变量。
在这里插入图片描述
再系统变量中找到path,点击新建,变量名为path即可,之后点击浏览目录,如果是默认下载位置,则位置在c盘。有mingw文件,点击bin即可完成系统变量添加,添加成功就是如上图所示。
四、检验安装成功与否
打开cmd,输入g++ -v即可检验g++版本在这里插入图片描述
之后输入gcc -v即可检验gcc版本。
到这里mingw就算安装完成,如果需要学习g++,我已经下下方贴上学习教程,大家可以按这个简要学习
https://cloud.tencent.com/developer/article/1176744

Installing c++/g++ on Windows Disclaimer: This page is being maintained mainly for my students. Use these instructions at your own risk. There is no warranty in any form or shape whatsoever!. There is no guarantee that these instructions are up-to-date. With that understood you may continue with the rest of this page if you choose to accept these terms. This page was last updated on September 13, 2005, but still good as of April 30, 2009. Follow these steps to install g++ (the GNU C++ compiler) for Windows. There is no room for creativity here; you must follow the directions exactly. Pick the drive and a folder in which you want to install g++. I'll assume that it is C:, but you can choose a different one. If you choose a different drive or a different folder, you'll need to adapt the directions below accordingly. Download full.exe, an about 14 megabyte executable, to C:\full.exe by right-clicking on the link. Use Save Link As... or Save Target As... Be sure the browser saves the file as C:\full.exe. Run the downloaded executable. This will install g++ (and a lot of other things that you don't really need) on your hard drive. Go to the C: drive using Windows Explorer and double-click on full.exe. Or, open a DOS window (Start > Programs > Command Prompt), connect to the C: drive using the cd command, and type full. Locate where the bin folder was created for the g++ installation. On my Windows XP machine, it was created in the following path: C:\cygnus\cygwin-b20\H-i586-cygwin32\bin You now should add it to the PATH environment variable. You do that by following: Start -> Control Panel -> System -> Advanced -> Environment Variables At this point you can see the PATH variable either in the User Variables or in the System Variables. Add the g++ path into the PATH variable. You add it to the end of the existing value separated by a semicolon (';'). Make sure that you do not lose the original value. You are just appending more to the end separated by a semicolon. Restart your computer. A Cygnus Solutions entry will appear in your Programs menu, and an icon may appear on your desktop. Don't use them! You will use it using the g++ command on a DOS prompt as explained below. You should now be able to run g++ from a DOS (Command Prompt) window. For example, to compile a file called C:\mine\hello.cpp, connect to the C:\mine folder and enter g++ -g hello.cpp -o hello -lm You'll then be able to run the compiled program by entering hello in the DOS window. If you've installed Emacs as described here, you will also be able to run g++ from Emacs. If, when you do this, Emacs tries to compile with the command make -k, you made a mistake during the Emacs installation. If you want to learn how to run g++ on emacs, see here. If you'd like to learn more about where this free compiler came from, we downloaded it from an older site of http://sourceware.org/cygwin/. If you wish to clean up a little, you may delete the file: full.exe at this point. Your g++ compiler is installed under C:\cygnus.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值