How to Compile C and C++ Projects on Windows
by InitializeSahib in Circuits > Computers
4274 Views, 13 Favorites, 0 Comments
How to Compile C and C++ Projects on Windows
Most people have written great code in C and C++ on Windows. However, the problem arises when they need to compile it. This Instructable will show two options for compiling these projects.
Compiling With Your IDE
Most programmers use an IDE (Integrated Development Environement) when developing applications. Most IDEs come with a compiler built in, or ask you to install a Developer Toolkit so the IDE can use the toolkit's compiler.
In the picture above I am using Visual Studio 2013 (Community Edition). On your IDE, it may be placed somewhere else, or not there at all.
Using MinGW
Doing a quick Google search of MinGW will lead you to it's SourceForge page. Download mingw-get.exe and run it. It will tell you to configure a few things, then it will show you an installation manager. First, check mingw-base, then click All Packages, then MinGW, and then MinGW base system. Mark for installation (right-click on the package name and click Mark for Installation) the following packages : mingw-gcc, mingw-gcc-core, gcc, gcc-core, mingw-gcc-g++, and gcc-g++. (If you can't find gcc, gcc-core, or gcc-g++, use the ones with mingw on them. This also applies if you can't find the mingw ones.)
After installation, open up your Command Prompt. Then navigate to where you installed it. Drag your code file into the directory where you installed MinGW. Finally, run g++ (for C++) or gcc (for C) followed by the code name. It should then generate a executable file simply called a. That is your compiled code.
Done!
Hopefully with one of those options you have successfully compiled your code. See you next Instructable!