I am using VC++ express 2005 and I have a dll and two header files. The one header file inherrits from the other and the dll contains the source code.

Can someone please tell me where do I write the include commands for these header files? I can create and use forms in test apps and the same goes for the dll and header files, i.e. I can use them in small test programs. but when I try to instantiate the headers in command buttons of projects which uses forms I fail.

Where do I write the include commands for such projects? Do I write the include command in the file which has the main function or do I write it in the code window which opens when I double click on the command button. Or do I write it somewhere else entirely.

>>where do I write the include commands for these header files

Not sure what you mean by that. Do you mean #include <myheader.h> ?

>> instantiate the headers
Headers are not instantiated. Only objects and POD (Plain-Old-Data) are. So again, I don't know exactly what you are saying.

Maybe post an example of what you want to do will help clarify your problem.

To any reader but also Ancient Dragon.

The name of the header file is CATCenterNetClient.h. The include command is going to be #include "CATCenterNetClient.h". The question is where do I type in this command. Do I type it in the file which contains function main or do I type it in the window which opens when I double click on the control which must instantiate the CATCenterNetClient object. And where specifically in this file. I mean. Should it go to at the top before the opening braces or in the click event section of the command button where I type in the to be executed code.

Include directives always, always go at the top of *.c and *.cpp files, you will often also see them in *.h files. If the program consists of more than one *.cpp or *.c file then the include directive should appear at the top of each file in which the object referenced in the include file will appear. Example: you have main.cpp and CATCenterNetClient.cpp, but only CATCenterNetClient.cpp will reference something in CATCenterNetClient.h then only put CATCenterNetClient.h. at the top of CATCenterNetClient.cpp. If both main.cpp and CATCenterNetClient.cpp reference something in CATCenterNetClient.h then add the include directive at the top of both main.cpp and CATCenterNetClient.cpp.

This matters only to inform the compiler about the classes and definitions used in the *.cpp files. It doesn't really matter if you include CATCenterNetClient.h in *.cpp files that do not use it, all it does is make compile time a little longer. The compiler will ignore CATCenterNetClient.h if it is not referenced in the a *.cpp file.

This article has been dead for over six months. Start a new discussion instead.