I'm reading a book on C and it's telling me how to use gcc and about the -c option/flag. It reads "-c Compiles to an object (.o) file instead of an executable. This is important for creating library files." What is an object file and how is this good for library files? I'm assuming this is for creating files that don't have a main function and are used only as a resource for other programs. Is my understanding correct? If so could someone give me a 2 very simple(hello world simple) code examples of a program that uses a custom object or library file. Thanks.

Recommended Answers

All 2 Replies

Reading the gcc man page is also a good idea. It's really long, but all the options are covered pretty well.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.