I compile my c code with gcc and it creates an obj code but when I tried to run it it gives cannot execute binary file error how can I solve this problem can you help me?

gcc -c virtualAddressManager.c -o vam


cannot execute binary file

Why are you creating an object file? If you want to create an executable, you shouldn't use the -c option.

Additionally, where did you get the vam.exe from? With the command you issued, you will get an output file called vam without the .exe part. You aren't working on Windows, are you?

To get an executable and run it, you should do

gcc virtualAddressManager.c -o vam
chmod +x vam
| improve this answer | |
  • you should not need chmod +x vam It won't hurt but gcc will make vam executable by default. – Warren Hill May 8 '13 at 20:04
  • No I am not working on Windows I have made a mistake here at vam.exe – Esat Bektaş May 8 '13 at 20:42
  • thanks a lot it works but core dumped :/ – Esat Bektaş May 8 '13 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.