Search code examples
c++cgccmakefilecygwin

C program compiled in cygwin with make: "cannot execute binary file"


I am trying to run a code by someone which can be perfectly "make"ed in linux and it works fine. When I "make" in cygwin and run it I get the "cannot execute binary file" error. When I "file" the executable it says:

$ file kmeans
kmeans: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped

Does "for GNU/Linux 2.6.9" I can't run it inside the Windows? Or what do you think the problem it?

Here is a screenshot: enter image description here

Here are my files, in case you want to take a look.

Update: my gcc version: gcc version 4.9.2 (GCC)


Solution

  • It looks like you have a kmeans (linux binary) and kmeans.exe Windows/cygwin version of your programm.
    When you call ./kmeans you try to execute the Linux version in Windows.

    Try to run kmeans.exe.