Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup MinGw on Windows 7 64 bit? [closed]

Tags:

c++

gcc

Before I get any down votes, I would like to say that I am a Mechanical guy with avid interest in C++ programming. Until today I have used VS 2010 Express & Qt Creator to suffice my needs. But now I want to compile Qt Creator in MinGw because the standard SDK is for 32 bit only. I have tried searching for clear instructions on the MinGW wiki, sourceforge, Blogs, etc. But that language is almost understandable for me. I want a Standard C++ Compiler which can Compile 64 as well as 32 bit applications on my Windows 7 64 bit Laptop. Eventually I downloaded

http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Automated%20Builds/mingw-w32-bin_i686-mingw_20111219.zip/download

When I extracted it to C:/MinGw64. The targets were like x86_64-w64-mingw32-gcc.exe, x86_64-w64-mingw32-g++.exe. I added them to the PATH Env variable & it compiles my program, but the name is so long. The steps to verify over here: Getting started with OpenCV 2.4 and MinGW on Windows 7

In the correct answer the command is "g++ -I"C:\opencv\build\include" -L"C:\opencv\build\x86\mingw\lib" loadimg.cpp -lopencv_core243 -lopencv_highgui243 -o loadimg" but this doesnt work for me. I have to enter "x86_64-w64-mingw32-g++" for compling. Have I done anything wrong? & which do I use to compile 32 bit apps?

Sorry if this is a very stupid question for you guys but I am pretty new to this stuff. Thank You1

like image 772
Cool_Coder Avatar asked Feb 14 '13 07:02

Cool_Coder


1 Answers

x86_64-w64-mingw32-g++ is the name of the compiler with the name of the target architecture applied. This is to difference between different versions of gcc on one machine. When you don't have any other gcc installed, you can copy x86_64-w64-mingw32-g++ to g++ and x86_64-w64-mingw32-gcc to gcc.

You can check if you have other versions of gcc, if you open a terminal (start->run->cmd), and type there gcc -dumpmachine. If it says something which sounds like a 32bit compiler, you have somewhere the 32bit compiler installed. If it says it is a 64bit compiler, you have nothing to do. If it says there is no gcc, the you have to copy the x86_64-w64-mingw32* compilers and add their path to the system path.

like image 195
Rudi Avatar answered Oct 30 '22 04:10

Rudi