One of the things I'm having a hard time understanding is how the compiler works. I'm having a lot of difficulties with it, but in particular I keep getting headers and libraries mixed up. If somebody could clear things up a bit, that'd be great.
C++ – What’s the difference between a header file and a library
c
Related Topic
- C++ – What are the differences between a pointer variable and a reference variable in C++
- C++ – the difference between g++ and gcc
- C++ – The Definitive C++ Book Guide and List
- C++ – Why can templates only be implemented in the header file
- C++ – Difference between private, public, and protected inheritance
- C++ – the difference between const int*, const int * const, and int const *
- Sqlite – Improve INSERT-per-second performance of SQLite
- C++ – What are the basic rules and idioms for operator overloading
Best Answer
Think of both like this (Disclaimer: this is a really high-level analogy ;) ..
It's the fundamental difference between "interface" and "implementation"; the interface (header) tells you how to call some functionality (without knowing how it works), while the implementation (library) is the actual functionality.
Note: The concept is so fundamental, because it allows you flexibility: you can have the same header for different libraries (i.e. the functionality is exactly called in the same way), and each library may implement the functionality in a different way. By keeping the same interface, you can replace the libraries without changing your code.
And: you can change the implementation of the library without breaking the calling code!