Connecting Tech Pros Worldwide Help | Site Map

ifndef

Michael Sgier
Guest
 
Posts: n/a
#1: Aug 19 '05
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
benben
Guest
 
Posts: n/a
#2: Aug 19 '05

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


glen stark
Guest
 
Posts: n/a
#3: Aug 19 '05

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.


Gianni Mariani
Guest
 
Posts: n/a
#4: Aug 19 '05

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