Author Topic: Setting up Code::Blocks for use with MinGW-64  (Read 13188 times)

Offline GypsyPrince

  • Single posting newcomer
  • *
  • Posts: 3
Setting up Code::Blocks for use with MinGW-64
« on: August 19, 2014, 06:10:47 pm »
Hello, I'm new here.

Right off the bat, this is NOT an an error of any sorts with Code::Blocks, it has more to do with my own incompetence.  I won't mince words.  Even though I'm pretty good at coding, when it comes to setting up compilers to use with an IDE, I tend to be an absolute airhead.  I have good experience with 64-bit programming, just not so while using either Code:Blocks or MinGW-64.  If the compiler isn't already pre-configured in the IDE, I'm pretty much screwed.  I'm wanting to graduate from the included 32-bit MinGW and I am trying to setup MinGW-64 v4.9.0.2 to use with Code::Blocks on 64-bit Windows 8.1.  I want to create two separate compiler setting profiles:

1.) "MinGW-64 (GNU GCC) x86 Compiler" for 32-bit programs  2.) "MinGW-64 (GNU GCC) x64 Compiler" for 64-bit programs

I know basically how to create each setting profile, but I don't know the correct info to include in each profile - most specifically, those under the "Search Directories" tab and the "Toolchain Executables" tab.

For the x86 profile:
1. which folder(s) do I list for the "Compiler" sub-tab under "Search directories"?
2. which folder(s) do I list for the "Linker" sub-tab under "Search directories"?
3. which folder(s) do I list for the "Compiler" sub-tab under "Search directories"?
4. which executables do I list for the "Program Files" sub-tab under "Toolchain executables"?

I also need these same questions answered for the x64 profile, because I know that often a person must utilize different headers and library files for 64-bit compilation as those for 32-bit programs.  The folder/directory structure and naming scheme for MinGW-64 is very confusing and makes no logical sense to me. I've noticed that with each progressive version release of MinGW-64, the folder structure keeps changing, so looking at older examples doesn't help me at all.  I've googled many examples for setting up this compiler with Code::Blocks and have tried using the documentation from the MinGW site.  However, I personally find their documentation to be vague and of poor quality and writing style.  So, sadly I'm left more confused than when I started. I've raise this same issue on other boards.  Each time someone tells me that I need to include these folders or that executable another person will then come along to contradict them, stating that I need these folders or that executable instead, and I don't know who is correct.

Hopefully, Code::Blocks will include pre-configured settings for MinGW-64 in its next release.  But until then, can someone PLEASE explain to me how to properly configure my compiler setting profiles for both 32 and 64 bit console/Windows GUI programming in standard C++.  I'm not sure if it makes any difference as far as the MinGW-64 folder structure is concerned, but I will be using the Windows API for GUI programming instead of wxWidgets.

Remember, when it comes to compilers I'm pretty much an airhead, so feel free to explain it to me like a child, and pictures are more than welcome...

Thanks in advance!!!
« Last Edit: August 19, 2014, 07:39:57 pm by GypsyPrince »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re:
« Reply #1 on: August 19, 2014, 10:08:24 pm »
Unfortunately it depends on the exact version of the Mingw compiler you intend to use... Which is...?! (Link...)

Reason: you need to specify the 64 bit executables which are named differently across 64 bit versions of Mingw.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline GypsyPrince

  • Single posting newcomer
  • *
  • Posts: 3
Re: Setting up Code::Blocks for use with MinGW-64
« Reply #2 on: August 20, 2014, 12:28:43 am »
Okay, after a bit more research on the MinGW site, here is what I've found:

Both x64 and x86 compilation will use the same executables. However, a switch is require to be placed in the "Other options" sub-tab beneath "Compiler settings".
-m32 is for 32-bit compilation and -m64 is for compiling 64-bit programs.

That's one issue down.  But I still can't figure out the proper folders to list for the compiler, linker, and resource compiler under the "Search directories" tab.

Here is the link for the compiler:
http://sourceforge.net/projects/mingw-w64/

While I really LOVE the MinGW compilers, this is one drawback that I often find with open source software is that it's usually poorly documented, and because the software  is also most often different in user interface from commercial or mainstream software, its lack of documentation makes it that much more difficult...

My job is to set in a cubicle all day and mindlessly crank out code for already laid out out libraries and programs.  I'm a low-wage code jockey.  We're switching from MinGW to the MinGW-64 compiler and I'm supposed to be the guinea pig.  But even our IT guy can't get this compiler to work correctly with Code::Blocks.  I don't have either the time or the IQ to figure this issue out on my own... LOL

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Setting up Code::Blocks for use with MinGW-64
« Reply #3 on: August 20, 2014, 01:18:17 am »
I also use mingw-w64 and the only thing I did to make it work was to duplicate the 32-bit gcc compiler and changed the executables to the correct ones. As far as I know you don't need the -m64 and -m32 flags because unlike tdm version mingw-w64 always compiles 64-bit and the compiler itself is a 64-bit executable. For 32-bit applications, they distribute the 32-bit version.

Offline GypsyPrince

  • Single posting newcomer
  • *
  • Posts: 3
Re: Setting up Code::Blocks for use with MinGW-64
« Reply #4 on: August 20, 2014, 02:06:15 am »
Okay... I don't know if it's configured correctly but our programs are compiling, and the executables are running like they're supposed to.
I'm glad it's my company that's doing this and that MinGW-64 is free. I personally wouldn't have it, and most certainly wouldn't sacrifice money to purchase it. I don't know if it's just poor planning on their part, but is most certainly a poorly planned delivery.

"x86_64-w64-mingw32-g++.exe" - Who names a file like this? Is it supposed to be 32-bit or 64-bit? I can't tell by it's name. Actually, it's both 64 and 32 bit, using the switch -m32 or -m64. There is no logic to this name. How about something like "mingw32_64-g++.exe"?  Nah... that would make too much sense.  Or how about folders like "x86_64-w64-mingw32", "lib32", and "libexec" that contain header file and libraries...

I'll use it because I'm getting paid to use it. But I'll stick with the pre-configured MinGW in Code:Blocks for my own personal stuff...
« Last Edit: August 20, 2014, 02:26:44 am by GypsyPrince »