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.
lewashby
56
Junior Poster
Recommended Answers
Jump to PostA simple static library is a bunch of ".o" files, stuck together. You need to read Mike's overview:
All 2 Replies
Moschops
683
Practically a Master Poster
Featured Poster
rubberman
1,355
Nearly a Posting Virtuoso
Featured Poster
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.