0

I am new to c++ and I am using g++ 10.2.0 in the windows 7 32 bit operating system. And I got this g++ from http://winlibs.com/ and I downloaded it and add it to my Codeblocks IDE. This website is saying that I have to put i686-w64-mingw32-g++.exe in my compiler because I'm using 32-bit operating systems. It means it is the compiler for the 32-bit operating system. But when I want to compile using windows command prompt and when I use g++ -o prog1 prog1.cc to compile a file named prog1 in a directory, then it compiles the file. So, my question is, shouldn't I put the i686-w64-mingw32-g++.exe because it is my compiler for 32 bit? And why is the g++ -o prog1 prog1.cc working in my software?

  • What does `g++ --version` print? – MikeCAT Apr 26 '21 at 11:58
  • It prints 10.2.0 and before this there is some texts. –  Apr 26 '21 at 11:59
  • 2
    Use cmake for building and I can recommend to use the MSVC on windows, the gcc on linux and clang on mac. I can not recommend mingw. – Superlokkus Apr 26 '21 at 12:02
  • I have a found a similar question in https://stackoverflow.com/questions/46324337/what-is-the-difference-between-g-exe-and-x86-64-w64-mingw32-g-exe/ but I can't understand what they meant. So, can someone explain what thet meant? –  Apr 26 '21 at 15:18

1 Answers1

0

If you downloaded 32-bit MinGW-w64 GCC from http://winlibs.com/ then i686-w64-mingw32-g++.exe and g++.exe are the same thing. GCC has a convention where target compilers have a full name of TARGET+-g++.exe so compilers for different targets can coexist. But here the native platform is the target so g++.exe is the same compiler as i686-w64-mingw32-g++.exe.

So running i686-w64-mingw32-g++.exe -o prog1 prog1.cc will give you the same result.

Make sure in Code::Blocks to also set "Compiler's installation directory" to the folder containing i686-w64-mingw32-g++.exe, otherwise Code::Blocks will not know where to find the file.

Brecht Sanders
  • 6,215
  • 1
  • 16
  • 40