Background
One of the great technical leaps in IT Technology in the last 20 years or so, is the co-existence of 32 and 64-bit computing on the same machine.
Linux
If you are curious as to whether a binary file is 32 or 64-bit and you are on a Linux machine, please use the file command.
File Command
Syntax
file <file-name>
Sample
32-bit file
Command
file bin/x32/helloWorld_x32.exe
Output
Output – Text
bin/x32/helloWorld_x32.exe: PE32 executable (console) Intel 80386, for MS Windows
Output – Image
64-bit file
Command
file bin/x64/helloWorld_x64.exe
Output
Output – Text
bin/x64/helloWorld_x64.exe: PE32+ executable (console) x86-64, for MS Windows
Output – Image
Summary
If 32-bit, the file command will return:-
- PE Flag:- PE32
- Console/GUI:- console
- Processor:- Intel 80386
- OS:- MS Windows
On the other hand, If the fie is compiled for 64-bit, the file command will return:-
- PE Flag:- PE32+
- Console/GUI:- console
- Processor:- x86-64
- OS:- MS Windows
Disclaimer
So you are on a MS Windows machine and you compiled your application using Visual Studio.
The executable runs well on a Windows machine.
Take same application to a MS Windows and try to run as is.
But, not so quick.
Make file runnable
chmod +x bin/x64/helloWorld_x64.exe
Run Command
bin/x64/helloWorld_x64.exe
Output
Textual
-bash: bin/x64/helloWorld_x64.exe: cannot execute binary file: Exec format error
Image