when someone include <iostream> how does the compiler know which library to load?
serkan sendur
821
Postaholic
Banned
Recommended Answers
Jump to PostThat's not a library reference, that's an include file reference.
The compiler (ok, maybe the preprocessor) will search for a file of the specified name through each of the directories in the include path. It will use the first file it finds. The contents of the file it finds …
Jump to PostThe C++ Standard (16.2):
2 A preprocessing directive of the form
# include <h-char-sequence> new-line
searches a sequence of implementation-defined places for a header identified uniquely by the specified sequence between the < and > delimiters, and causes the replacement of that directive by the entire contents of the header. …
Jump to Posti know that when i include <iostream> i include a header file not a library. That is why my question is how the compiler knows the associated library with that header.
So simple answer: it does not know that ;)
The compiler includes external symbol references to library function names …
All 10 Replies
Murtan
317
Practically a Master Poster
ArkM
1,090
Postaholic
serkan sendur
821
Postaholic
Banned
ArkM
1,090
Postaholic
Murtan
317
Practically a Master Poster
serkan sendur
821
Postaholic
Banned
Narue
5,707
Bad Cop
Team Colleague
Murtan
317
Practically a Master Poster
serkan sendur
821
Postaholic
Banned
Narue
5,707
Bad Cop
Team Colleague
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.