I'm using the MinGW-w64 version tagged as x86_64-8.1.0-posix-seh-rt_v6-rev0
. When running g++ --version
, I see this:
g++.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0
From my understanding, this version of g++ should generate 64-bit binaries by default.
The compiler command is like this:
g++.exe -std=c++17 -g main.cpp -o main.exe
However, if main.cpp
looks like this:
#include <iostream>
int main() {
std::cout << sizeof(long);
return 0;
}
It prints 4
instead of 8
. I tried using a -m64
compiler flag, but it changed nothing.
What am I doing wrong, and how to fix this?