Define and #ifdef

I see a lot of c++ codes that has in the first lines anything like

1
2
   #ifndef anything_h
   #define anything_h 


I know what this code does, but I just cant understand the reason of that.

Why I should create a define/header for something? Whats it changes?
Can someone give me a good example of when I should use?

The only good one I know is
1
2
3
4
  #ifdef WIN32
     //WINDOWS CODE HERE
  #else
     //LINUX CODE HERE 

Topic archived. No new replies allowed.