I need to know how to make a binary with gcc. I know how to create an obj file, but I'm not quite sure what to do about the linking part. I've gotten this far "gcc -c somefile.c somefile.o" then I'm left with an object file, but I don't see any linking command line options. Does anyone know how to do this? Thanks, for your time.
-lil programmer
You don't need to explicitly compile and then link the .c file. Instead, executing:
will first compile, then link, and the executable will be called filename.
Anyway, since you asked how you would link, the command is ld. See man pages on the same to learn how.
if you have created the object file using the gcc -c command,
you can link them all using "gcc -o"
gcc -o file file1.o file2.o .. and so on
here "file" will be you executable
thanks
asif
Thanks a bunch you guys that really helped! I'm wanting to switch totally to linux/unix, but I needed to learn how to use thier compilers before I could start writing code :). Thanks again for your time.
-lil programmer
i thought you were working on linux only.
anyways man pages are the best thing for you to start.
for any help, just do a man <command_name>