Nick
Nick

Reputation: 9031

How could I know the version of gcc is 64-bit or 32-bit?

I am using windows 7 64-bit. I don't know the gcc installed on this computer is 32-bit or 64-bit. (Windows 7 support both 32- and 64-bit programs).

Upvotes: 9

Views: 15400

Answers (2)

Sanjaykumar
Sanjaykumar

Reputation: 1

write a c code as follows:

#include<stdio.h>
#include<stdlib.h>
void main(){
    int*pointer;
    printf("%d", sizeof(pointer));
    
}

then compile and run this

if the output shows 8, then the compiler version is 64 bit else if the output shows 4, then the compiler version is 32 bit the size of the c pointer is equal to the compiler version

8 means 8 bytes= 64bit

4 means 4 bytes= 32bit

Upvotes: 0

rubenvb
rubenvb

Reputation: 76519

You can inspect the output of gcc -v or you can use the more direct option -dumpmachine. The first option allows you to discover if GCC is capable of multilib (so that it can compile both 32 and 64-bit binaries), the second option will only return the default target (if I am not mistaken).

Upvotes: 12

Related Questions