PDA

View Full Version : Can't compile anything.


stabbymctwist
December 12th, 2007, 11:41 PM
So I made the simplest c/++ program I could think of, compiled it, and tried to run it. I get "bash: ./sillystring.o: cannot execute binary file".


int main () {
return 1;
}


build-essential is installed. I did search the forums, too. Google, as well. Sorry if it's a repost. Using gcc outputs no errors at all.

Am I missing something important?

geraldm
December 13th, 2007, 12:46 AM
# check for syntax; create object *.o file
gcc -c -I. hello.c
# compile to executable
gcc -o hello -I. hello.c
# test
./hello

# for C++, suffix differs; use g++ instead of gcc; *.cpp instead of *.c
Gerald

stabbymctwist
December 13th, 2007, 01:01 AM
Wow, Thanks a lot, seriously. I feel dumb now, heh.