cannot execute filename.o file in cygwin with gcc

I have a build shell script that reads as follows,

#!/bin/sh
gcc -o posture.exe main.c posture_algorithm.c

Then I run the following command to set permission,

chmod 755 posture_algo.o

followed by,

./posture_algorithm.o

I get the following error,

-bash: ./posture_algo.o: cannot execute binary file: Exec format error

1 Answer

posture_algo.o is a file containing object code. The executable your script creates is posture.exe, so you should be running:

chmod +x posture.exe
./posture.exe

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like