Thursday 1 December 2011

Question about building in linux & object files

Question about building in linux & object files

Hi!

I am a programmer that is new to the Linux environment, and I have a question regarding this.
Suppose I have a hello.c file, I know it's compiled by:

gcc -c hello.c

which in turn creates an object file "hello.o", and then when I do

gcc -o Hello hello.o

It creates a file without any extension, called "Hello". When I say "file Hello" and "file hello.o" to learn the file types, it says:

"Hello: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped"

and

"hello.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped"

Now, I thought that the "hello.o" object file was the ".exe" of Windows programs, that I could run it, but what is "Hello"?
Besides, when I say

gcc -o Hello hello.c directly without doing the compilation first, it doesnt give any "hello.o" file but directly a "Hello" executable. Why is this and what are the differences between "hello.o" and "Hello"?

Another question is what does "not stripped" mean?

Thanks!

Can

No comments:

Post a Comment