Thursday, July 9, 2009

#include in Visual C++?

A source cpp file I write:


#include %26lt;xxx.h%26gt;


.....


if I don't use all of the methods of %26lt;xxx.h%26gt; but just load only one method from it, is the all members or classes of xxx.h being inserted to the final exe files ?


If the answer is yes, how can I just get the methods I want from the head file but not import all of those codes?


just like we do in Java, no need to import a total package, you can only import a class.

#include in Visual C++?
If it's managed C++ (aka, the .net flavor) then yes, the .exe manifest will contain all classes defined in the header, and you can't exclude a few.





If it's regular C++, then only variables declared in the header will be included. Headers typically only contain definitions to help the compiler, and so do not contribute to the resulting .exe file (at least when they're written following standard design patterns).
Reply:declare


extern classname::method(..)


No comments:

Post a Comment