Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

./vam.exe

cannot execute binary file
share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

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
./vam
share|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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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