cygwin - cannot execute binary file

纵然是瞬间 提交于 2019-12-03 07:54:31

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?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!