So... I have to run some code, and it takes hours to run. In the meanwhile, I was thinking of programming some stuff: I have been reading a lot about Neural Networks lately and I thought I could generate some code to guarantee that I do understand the concepts as well as I believe I do. But the problem is: I wanted to have fun, and I can only have fun if I do my program beautifully in C++. My first step was (as I would do when I was giving my initial steps towards becoming a C++ programmer) installing Code::Blocks; but I soon realized it hides a lot of my options behind that User Interface, and it is really annoying having to search for everything there. I needed a a g++, a Makefile... stuff that I am used to when programming in Windows.
When I was in my third semester in my Bachelor, I had tried installing MinGW once, and it was really a pain (and in the end I failed miserably). I decided I would do it this time. MinGW has everything I need: it has a compiler (g++.exe) and a make (mingw32-make.exe). If you go to their website, you can find a nice installer. I tried installing it following the orientations in Documentations->Getting Started. Basically, all I had to do was to run that installer (notice that, ideally, you should install MinGW in an address that doesn't have spaces -- as they say in the website, the best place is C:/MinGW), and a nice window would appear asking me which packets to install (pretty much like the Package Manager of Ubuntu). I chose the packets I wanted, clicked in Apply Changes, and everything seemed to have worked perfectly.
Then, following the rest of the instructions, I was supposed to have installed MSYS. MSYS is a minimalist shell with whatever I may need to run the MinGW commands more comfortably. It is important to notice: one can use MinGW from the Windows `cmd`. I wanted a lot a nice shell... and it was only then that I realized I actually already had one: if you install Git in Windows (which I was going to do next anyway) it comes along with MSYS2 (apparently some fancy version of MSYS -- I didn't take the trouble to read more about it). If you run `Git Bash` in your system, this is what I am talking about.
One can configure Git Bash by editing a file called .bash_profile in the home folder. Just type
$ vim ~/.bash_profile
to edit this file. In this file, I edited the path to include MinGW, and also made some alias (so that I don't have to write `mingw32-make` everytime I want to run make. I included the following lines:
alias make='mingw32-make'
PATH=$PATH:/c/MinGW/bin
Done. Now you can run stuff like g++ blah.cpp to compile any .cpp file, or also make to run your Makefile. The nice thing is that, if you go to the MinGW folder and run ./mingw-get you can still install a lot of MinGW libraries using its package manager. Then you just need to include something like
CXXFLAGS=-I/c/MinGW/include
in your Makefile to allow g++ to find the library, and probably include some linking flags along.
I was happy on how simple all of this was.
R$