Cygwin - unable to execute binary

I am trying to run these two .data files from my C ++ code for my purpose. I have been provided with all the files and are intended only to implement several functions for the program (everything should be able to compile the make command).

I used to start the MAC and just started using Windows (win 7) because work gave me a free laptop. Anyway ... I installed cygwin, added the gcc-C ++ compiler, gdb and made packages for my cygwin. But when I run the ./file ./data , it comes with:

 bash: ./file: cannot execute binary file 

Is there some kind of package or something that I can install? Note that. / data is the folder where my two files are stored .tata, file1.data and file2.data

compiled with

 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 
+4
source share
1 answer

Start with the file command to find out what type of binary you have:

 file ./file 

If this is not an executable file, this is the problem. If it is an ELF executable, then it is probably intended to run on Linux, not Windows. For example, compare the output with this command:

 file /bin/bash 

which should tell you:

/ bin / bash: PE32 executable (console) Intel 80386 (divided into external PDB), for MS Windows

Now try the following command:

 file /cygdrive/c/windows/write.exe 

Which says the following: /cygdrive/c/windows/write.exe: executable file PE32 + (GUI) x86-64 for MS Windows

I ran this on a 64 bit installation of Windows 7, so it says x86-64. Although this is a Windows GUI application that is completely unrelated to cygwin, I can still start it with the command:

 /cygdrive/c/windows/write 

You really didn't explain how you got this binary called ./file . Is it possible that this is an object file from compilation that you have not yet associated with the executable file? If you have a Makefile, why not post its contents?

+9
source

All Articles