On Mon, Jan 25, 2010 at 2:56 AM, Jimmy Johnson <[email protected]> wrote:
> Thanks, the second solution works.
>
> But to make sure I'm understanding this.
> I *can* use
>
>  #ifndef __glut_h__
>    #include <GL\glut.h>
>  #endif
>
> to ensure glut.h is not included twice, but is it necessary?

No. Not necessary at all. That's the point of the include guards -
they make it not matter.

>  If the file is only "processed once" then what is the point?  It seems to 
> make no difference in my code.

The point is if the file /is/ included more than once, the guards
ensure the contents of it is only processed once.

> Now to the second thing.  I set the preprocessor directive as described and 
> it fixed the problem.
>  (I'll have to read about preprocessing when I have more time.)  Dhis mean 
> that anyone using my code
> (specificly myClass) will have to do that as well?

You could try

#define GLUT_BUILDING_LIB

just before every occurrence of

#include <glut.h>

> How do you let users of your classes
> (assuming we are going for reuse in our library classes) know to do this?  Is 
> this setting only for this
> project now does it apply to my visual c++ setup?

If it's a VS-only setting (and it would appear to be,) it would apply
to any project that uses that header file. To let the users of your
class know about it, you put it in the documentation for *your*
library.

You do have documentation don't you? ;)

At a push, put it in a comment towards the top of your header file:

/* If using MS VS, you need to set up the following options
  for the build....
  [....]
*/



-- 
PJH

http://shabbleland.myminicity.com/
http://www.chavgangs.com/register.php?referer=9375
http://www.kongregate.com/?referrer=Shabble

Reply via email to