functions in includeed files in C++
When you include a file in C++ such as iostream, it contains the function definitions. Where are the functions?
Quote:Original post by Tera_Dragon
In the source (.c .cc .cpp) files. Like your code should be too ;)
He's asking where the stream functions are, not his own functions.
I believe they are in the .lib(or .a) files that you link with or a DLL. Most compilers will link with the standard libraries without you having to say so.
Quote:Original post by ScetQuote:Original post by Tera_Dragon
In the source (.c .cc .cpp) files. Like your code should be too ;)
He's asking where the stream functions are, not his own functions.
I believe they are in the .lib(or .a) files that you link with or a DLL. Most compilers will link with the standard libraries without you having to say so.
Ah ok, missed that. Sorry about that, Scet is right.
Nope, .lib (or .a) is used by the linker to create the executable by "copying" in the functions and symbols it needs. DLLs (or .so) are linked when the application is run (thus the name Dynamic Runtime Library).
IIRC the standard library source ships with VisualStudio.
Cheers,
Drag0n
IIRC the standard library source ships with VisualStudio.
Cheers,
Drag0n
Quote:Original post by chaosgame
How does the linker know to include these files?
Any file you include, header or not, becomes part of the file you included it into, just as if you had cut and pasted it.
Quote:and is there code in these files?
Yes. Mostly class definitions with inline functions.
Normally you would have to add them to project options however any modern compiler automatically includes the standard library .lib files(for things like iostream).
They don't contain C++ code. Instead they contain precompiled code(machine code/debug symbols) that the linker adds to your executable(.exe) to form the program.
Basically the function definitions are in the plain text headers so the compiler can see mistakes before linking and the libraries contain the actual machine code(or something close to it).
They don't contain C++ code. Instead they contain precompiled code(machine code/debug symbols) that the linker adds to your executable(.exe) to form the program.
Basically the function definitions are in the plain text headers so the compiler can see mistakes before linking and the libraries contain the actual machine code(or something close to it).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement