I was able to reproduce this issue with a simple case (shown below). The problem in particular is that the output of compiling my main C file is a file with format data
(returned by running file
on the file). When the file is run, the command line gives the error cannot execute binary file: Exec format error
.
The file, main.c contains the following code:
#include <stdlib.h>
int main(int argc, char* argv[])
{
return 0;
}
I am using this command to compile the code: gcc main.c -o main
.
Output of gcc --version
:
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.1) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Any thoughts, comments, or ideas are appreciated.
file
on an executable should give you a whole bunch of information about the bitness and the file format, but runningfile
on main gives the outputdata
(i.e. not an executable file). I think @gslin's answer is correct.