-
August 26th, 2009, 04:56 AM
#1
#include questions: a class included many times things work fine ?
i have a class inherited from base class cobjec
i include many h files to test it in console. FINE everything fine, I smile!
but then i leave my class into a dialog based application, delete afxwin.h and other afx...h
i got abunch of errors at the base class functions, i stop laughing.
how to fix this , how to test this
could someone help me please, i am new to this
thanks a lot
-
August 26th, 2009, 07:23 AM
#2
Re: #include questions: a class included many times things work fine ?
Your .h files need "include guards". Also, if you create function, or implement methods inside those .h files, then you need to declare them inline.
Without those, your code works fine, but if you include it more than once, everything crashes.
-
August 26th, 2009, 08:13 AM
#3
Re: #include questions: a class included many times things work fine ?
Originally Posted by monarch_dodra
Your .h files need "include guards".
Lack of these will cause compile errors.
Also, if you create function, or implement methods inside those .h files, then you need to declare them inline.
Or else you'll get linker errors.
Without those, your code works fine, but if you include it more than once, everything crashes.
I prefer to reserve the term "crash" for runtime problems, personally.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|