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
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?