How to install MinGW correctly on Windows - c++

I have recently started learning C++, but I require a compiler. I have tried the one packaged with Code::Blocks, but I have been told it is out of date.
I have tried reading the instructions on the website, but I simply don't know which files to download and un-zip. Is there a list of files to download? (latest version) and a folder structure I need?

I was the person that pointed you at the more up-to-date version at Twilight Dragon. The file you want there is http://sourceforge.net/projects/tdm-gcc/files/TDM-MinGW%20Installer/1.908.0/tdm-mingw-1.908.0-4.4.1-2.exe/download which is a Windows binary installer - you just run it. Note that you don't actually need to do this - the version that comes with Code::Blocks will work OK for someone starting to learn C++.

I recommend using a pre-packaged MinGW that includes some common APIs like Boost, SDL etc: http://nuwen.net/mingw.html
If I remember correctly, the only thing you must do to get it working is to modify Windows's PATH environment variable.
edit: OpenAL is not included in this package.

Here are some instructions to have a MinGW setup that I used to build Octave modules.
I have switched to using the build environment for msysgit. Just download the netinstall file and it will setup GCC, Make, etc. along with Git.

Related

Building GSL (GNU Scientific Library) in Windows for use with VS2015

I am trying to build GSL as a library(DLL,lib) to use with my application. I have tested both GSL ports(gladman) to VS and CMake route and I do not want to go that path due to various reasons.
Currently I am using nuget version and I am not too happy about it as some functions are missing. I want to build it myself to be absolutely sure about what I am getting. The objective is to build four set of dll and libs---win32, win32d, win64 and win64d.
I know that from a MinGW library I can build lib file(for VS2015) and thereafter dll using Microsoft LIB tool if I have DEF file available.
My open source experience is very limited. Till now I have successfully built gsl for MinGW using ./config, make, make install. But I am not finding any DEF file generated and I do not know how to utilize this build to generate required DEF and dll to be used with Microsoft Visual Studio 2015.
Thank you
Building and linking has always been a pain for me as well. For mac, I use Homebrew, which downloads frameworks and libraries through a simple one-line-command in the terminal. I would then simply add the library into my program by adding the directory of the libs necessary. In XCode, there was an "add framework/library"-button where I added the directories, but I'm sure there's an analogue in VS.
However, you seem to be using Windows (so Homebrew will not work). I searched the web for Windows versions of Homebrew, and it seems that Scoop is pretty similar. You might want to check that out.
Hope this helped, despite me using different tools :)

Building log4cplus for Windows x64

I am supposed to build existing Windows 32bit project for Windows 64bit. (and probably linux 64bit too).
The project uses log4cplus library. That one only contains 32bit .lib files at the moment and is shining example of why I hate using libraries in C++ - there's just a bunch of source files and linux bash scripts. The INSTALL help file is entirely about the configure bash script which doesn't work on Windows. The configure probably just passes some arguments to GCC, but I don't known which ones.
I downloaded MinGW in hope I'll be able to use mingw32-make on the project and it will work, but no such thing happened.
So does anyone have any experience making those Linux projects on Windows? This is not the first time I tackle this problem - my third most viewed question is about broken Boost build. Judging from the view count, I'm not the only one who has problems building Linux project on widnows.
log4cplus maintainer here.
The master branch of log4cplug GIT repository is C++11 only. Because of this, it requires Visual Studio 2015 and thus the msvc14 directory is there.
Branch 1.2.x and its releases come with Visual Studio project files for version 2010. However, you might be able to build it using CMake for even older Visual Studio.
However, both of them, in any configuration, should have no problem building for AMD64 platform.
I also suggest that you read the README.md file. It documents many things, some of which might be useful to you, too.

installing thrift idl

Basically I have no idea how to create the lib files. The VS solution that come with thrift(0.9.0) say they are created with a newer version and therefore cant' be open with VS 2008. I've also tried installing or running the ./bootstrap.sh but I keep getting an error saying that the file is not an executable.I've been screwing with this for hours and can't figure it out so if someone who knows how to install thrift please guide me.
I haven't been using thrift on windows, but I hope it doesn't matter. First you have to install thrift locally (0.8.0, 0.9.0, whatever). On linux you run ./configure, make, make install. Once you've got your thrift locally installed, you do have the thrift binary and you should make sure it is on the shell path (on linux it's /usr/local/bin/thrift). Then create a thrift definition file with a service, run the thrift binary against that file and thrift will generate code for you (I assume you'll generate C++ code).
Now - for each programming language thrift generates different files, of course. In scripting languages you have to include them manually. In Java you will have a package and you can use it in the rest of the code. And in C++ you'll get .h and .cpp files which you should compile into a library. I strongly encourage you to use cmake, which is a wonderful tool to perform such things automatically.
Anyway, I wouldn't expect that MS Visual Studio will happily cooperate with open source software such as Apache Software Foundation projects ;)
You need use VS2012 and boost_155 like minimum to create the thrift lib files.

how to compile c++ files with cygwin on windows 7

I have installed cygwin. But when I try to compile a c++ file it gives the following error:
/usr/lib/gcc/i686-pc-cygwin/4.3.4/cc1plus.exe: error while loading shared libraries: cygmpfr-1.dll: cannot open shared object file: No such file or directory
I checked in the lib folder there is no library with the name cygmpfr-1.dll. So is it that I have to put that dll in the lib folder. I have tried to search for the dll but could not find this dll so that i can download. I am just a beginner in C++. I have tried to setup cygwin support in netbeans as well, but there also if I try to run the sample files given, it throws the above error.
Can anybody give me a clue?
You need to install the gcc4-g++ package via http://cygwin.com/setup.exe
You only have gcc4 installed.
This will also install your missing dependencies.
If you're a beginner in C/C++, and you're running Windows, then why not take the simple route and get Visual-C++ Express, a free IDE from Microsoft for Windows.
It provides a GUI IDE (Integrated Development Environment), but if you prefer a text editor and command-line tools (compilers, debuggers, etc) those are available to you also, if you install Visual-C++ Express.
There are also tutorials and lessons to get you started.
On the other hand, if you really wanna focus on C++ on Linux, then you should probably uninstall Windows 7 right now.
I have had similar problems and I am no beginner. Try using the cygwin installer, and searching it for all versions of gmp. There generally are 32bit and 64 bit versions. Check everything you see and update your installation. Hope this helps. Some of these dll's you can find on the internet, but not the one you are looking for.

iads.h / VS2005 / W2003 SP2 - which SDK and what are the side-effects?

I'm trying to compile someone elses C++ program using VS2005 on Windows 2003 (SP2).
The compile fails because it can't find iads.h
Which SDK should I install to get this header ?
When I install the SDK is there a danger I might break something already in use ? As far as I can tell the W2003 has no SDK's installed but if it did would installing a different one cause problems ?
You need to the windows sdk. The SDK doesn't install like a regular application. Just because you "installed" it it doesn't change any settings in your compiler.
You will still have to add the directories to header files and libraries in the vs settings page.
You can have multiple version of the windows sdk, you just need to update the directories in the vs options page.
It should be found in the vc\PlatformSDK\include folder. If not then you need to check your installation or you can install the Windows SDK.
The normal Windows SDK includes <iads.h>. I virtually never run a copy of Windows without an SDK installed, so I'm probably not in a good position to say what might work differently if it wasn't, but not much seems broken to me...