Connecting Tech Pros Worldwide Help | Site Map

ifndef

  #1  
Old August 19th, 2005, 10:05 AM
Michael Sgier
Guest
 
Posts: n/a
Hello
I get the error below. But why and what does ifndef? Well what
is ifndef?
Many thanks and regards
Michael
error: syntax error before `(' token


#ifndef MD2SwapInt
static __inline__ Uint32 MD2SwapInt(Uint32 D) {
return((D<<24)|((D<<8)&0x00FF0000)|((D>>8)&0x0000F F00)|(D>>24));
}
#endif
  #2  
Old August 19th, 2005, 10:35 AM
benben
Guest
 
Posts: n/a

re: ifndef


> Hello[color=blue]
> I get the error below. But why and what does ifndef? Well what
> is ifndef?
> Many thanks and regards
> Michael
> error: syntax error before `(' token
>
>
> #ifndef MD2SwapInt
> static __inline__ Uint32 MD2SwapInt(Uint32 D) {
> return((D<<24)|((D<<8)&0x00FF0000)|((D>>8)&0x0000F F00)|(D>>24));
> }
> #endif[/color]

I don't get a syntax error. What compiler are you using?

Ben


  #3  
Old August 19th, 2005, 11:25 AM
glen stark
Guest
 
Posts: n/a

re: ifndef



"Michael Sgier" <sgier@nospam.ch> wrote in message
news:43059fb4$0$1153$5402220f@news.sunrise.ch...[color=blue]
> Hello
> I get the error below. But why and what does ifndef? Well what
> is ifndef?
> Many thanks and regards
> Michael
> error: syntax error before `(' token
>
>
> #ifndef MD2SwapInt
> static __inline__ Uint32 MD2SwapInt(Uint32 D) {
> return((D<<24)|((D<<8)&0x00FF0000)|((D>>8)&0x0000F F00)|(D>>24));
> }
> #endif[/color]
I don't know why you get the syntax error. I would suggest looking for a
missing a ; or a close parenthisis or some such from a previously included
header.

as for what is ifndef:

#ifndef is a directive that tell is the compiler "if MD2SwapInt is not
defned, then include the following code:" (if not defined).

Since you are getting an error from your code, MD2SwapInt has clearly not
been defined.


  #4  
Old August 19th, 2005, 12:25 PM
Gianni Mariani
Guest
 
Posts: n/a

re: ifndef


Michael Sgier wrote:[color=blue]
> Hello
> I get the error below. But why and what does ifndef? Well what
> is ifndef?
> Many thanks and regards
> Michael
> error: syntax error before `(' token
>
>
> #ifndef MD2SwapInt
> static __inline__ Uint32 MD2SwapInt(Uint32 D) {
> return((D<<24)|((D<<8)&0x00FF0000)|((D>>8)&0x0000F F00)|(D>>24));
> }
> #endif[/color]


What do you think the compiler would do with the following code:

int x;

#ifndef x
float x;
#endif

?

It should give an error.
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
#pragma once vs #ifndef on V.S. Studlyami answers 6 October 25th, 2007 09:00 PM
Hi, What is the meaning of #ifndef Qiao Jian answers 9 November 14th, 2005 09:36 PM
#ifndef #define #endif and multiple definitions problem prettysmurfed answers 3 July 19th, 2005 08:38 PM
#if !defined() vs #ifndef Evan answers 4 July 19th, 2005 04:20 PM