Reputation:
If a header file (.h) included in the source file has also been included in a static library (.lib), what will happen?
Upvotes: 0
Views: 203
Reputation: 400109
A typical library implementation will include its own header, so this is not a particularly special case.
If the header declares things like global static variables, you of course can't define them more than once. Typically a library will include definitions for the data it declares (or, better, not declare any static global data) so your code that uses the library shouldn't duplicate those.
Upvotes: 2
Reputation: 5384
I don't think anything will happen unless some objects have been instantiated in the header file:
i.e.:
CMyStringType superMansName("Clark Kent");
Will result in a link error where the object exists in both the static library and your code.
Upvotes: 1