C++, turning a .cpp and .h combo into an import library

CodeX

2[H]4U
Joined
Mar 21, 2006
Messages
2,879
I should know this by now but I don't. I have a set a functions and structures I use in every program I write. I have this in a header file called "MyD3D.h" and its implementation in a file called "MyD3D.cpp". Now, I want the implementation file hidden from anyone who wants to use my library. I think that to do this you create an import library so that whoever uses it would first include the header file and then link to the library file. However, common include files (iostream, fstream, conio, etc) don't need any associated library file. All you have to do with them is include the header. Is this because they are built into the language or is there a way I could make my own like this, so that all you would have to do is include the header and not have to link anything? In either case I am not sure how to do it. Thanks in advance.
 
The includes you listed are not "built into" the language - they're libraries that are linked automatically by the linker.

To get what you're asking for, you can compile your .cpp into object code, a static library, or a dynamic library. In any of those cases you're going to have include the header and link it in manually.
 
Okay, can you give me specifics on how to do that in Visual C++ 6?

*edit* Nevermind, figured it out, thank you for your help.
 
Back
Top