Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MinGW 64 Bit Install trouble

Hello i am trying to install the 64 bit compiler of MinGW so that i can program in c 64 bit but am not sure exactly how to accomplish this. I have download the 64 bit zip file and extracted it to the folder i want but am not sure how to get the compiler to work. My command line still seems to recognize the program i am using as 64 bit.

Any help is appreciated.

like image 723
Sean Avatar asked Jan 16 '23 20:01

Sean


1 Answers

Step by step instructions:

1) Download and extract mingw package from mingw-builds:

  • GCC 4.7 for 32bit host OS - i686 and x86-64 targets
  • GCC 4.7 for 64bit host OS - i686 and x86-64 targets

(actually first one should work fine on both host platforms)

2) Lets say the target directory was c:\mingw

Copy the code below to the test.cpp

#include <cstdio>
int main() {
    printf("sizeof(void*)=%d bytes\n", sizeof(void*));
    return 0;
}

3) Compile 32 bit target:

c:\mingw\bin\i686-w64-mingw32-c++.exe -m32 -o test.exe test.cpp
OR
c:\mingw\bin\x86_64-w64-mingw32-c++.exe -m32 -o test.exe test.cpp

4) Compile 64 bit target:

c:\mingw\bin\i686-w64-mingw32-c++.exe -m64 -o test.exe test.cpp
OR
c:\mingw\bin\x86_64-w64-mingw32-c++.exe -m64 -o test.exe test.cpp
like image 65
sigman Avatar answered Jan 30 '23 05:01

sigman