I am trying to run these two .data files from my c++ code for my assignment. I have been provided with all the files and are meant to only implement a few functions for the program (everything should be able to compile running the make command).
I used to run a MAC and only just started using windows (win 7) because work gave me a free laptop. Anyways...I installed cygwin, added the gcc-c++ compiler, gdb and make packages to my cygwin. But when i run the command ./file ./data
it comes up with:
bash: ./file: cannot execute binary file
is there a certain package or something I am suppose to install? Please note, that ./data is the folder that holds my two .data files, file1.data
and file2.data
compiled by"
g++ -Wall -Werror -02 -c file.cpp
g++ -Wall -Werror -02 -c file-test.cpp
g++ -Wall -Werror -02 -o file file.o file-test.o
To resolve, you need to use an ARM binary and not an x86 binary. If the source is available, you can recompile/rebuild under an ARM system. If the source is not available, check with the vendor for an ARM binary. The official JRE from Sun, for example, has both x86 and "embedded" or ARM versions.
The “cannot execute binary file exec format error” message is a warning that indicates that the file you are trying to open may not be executable. It is due to various issues, including incorrect file permissions or incomplete installation.
Executing With the File Manager Open File Manager and navigate to the directory containing the program file (a shell script or a binary program file). Right-click on the file and click Properties. Click the Permissions tab. Select the Allow executing file as program option.
Press "Enter" on the keyboard after every command you enter into Terminal. You can also execute a file without changing to its directory by specifying the full path. Type "/path/to/NameOfFile" without quotation marks at the command prompt. Remember to set the executable bit using the chmod command first.
Start by using the file
command to see what type of binary file you have:
file ./file
If it is not an executable, that is a problem. If it is an ELF executable then it is probably intended to run on Linux, not on Windows. For example compare the output with this command:
file /bin/bash
which should tell you:
/bin/bash: PE32 executable (console) Intel 80386 (stripped to external PDB), for MS Windows
Now try this command:
file /cygdrive/c/windows/write.exe
Which says the following: /cygdrive/c/windows/write.exe: PE32+ executable (GUI) x86-64, for MS Windows
I ran this on a 64-bit Windows 7 installation, which is why it says x86-64. Even though this is a Windows GUI app totally unrelated to cygwin, I can still run it by the command:
/cygdrive/c/windows/write
You really did not explain how you got this binary file named ./file
. Is it possible that it is an object file from compiling that you have not yet linked into an executable? If you have a Makefile, why not post its contents?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With