Wrapper
Hi, I have just wrote a wrapper class for all my Win32 app''s. When I include the header file, I have to manually insert the source file into all my projects. How would I not have to do this? At first, I thought I might have to make a .dll or .lib, Is this the right way to do it, or should I just define the class in the header file?
Hey man, I don''t wanna sound like a queer or nothin'' but i think unicorns kick ass! -> Orgasmo.
Life is all about expression, so express yourself.
the normal way to do this is to compile the .cpp file to an object file, then add this to the link phase. In visual C++ this is done automatically by adding the cpp file to your project. If the class is a wrapper, you may want to consider just making everything inline. This is normally done by just adding the body in the class definition.
in the above example when the compiler sees bar.reset() it replaces it with {bar.x=0;} inline functions are almost like macros except that the compiler is aware of them and can work a good bit more magic upon them.
class foo { int x;public: void reset() {x=0;}};foo bar;bar.reset();
in the above example when the compiler sees bar.reset() it replaces it with {bar.x=0;} inline functions are almost like macros except that the compiler is aware of them and can work a good bit more magic upon them.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement