PDA

View Full Version : cannot execute binary file



cbrad
May 6th, 2007, 03:48 AM
I created a program in c++
I compiled the program without errors

$ g++ -c filename -o filename.o

$ ./filename.o

message : cannot execute binary file

can anyone help?

thanks

Wybiral
May 6th, 2007, 05:41 AM
The "-c" flag generates an object file... This isn't what you want to execute (object files are used for linking).

Omit the "-c" flag and don't use the ".o" extension if you are creating an executable file.

WW
May 6th, 2007, 06:44 AM
For example... (http://ubuntuforums.org/showpost.php?p=2448880&postcount=3)

WW
May 6th, 2007, 06:47 AM
An example with multple source files... (http://ubuntuforums.org/showpost.php?p=2524773&postcount=9)