473,396 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ifndef

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
Aug 19 '05 #1
3 3188
> 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


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

Ben
Aug 19 '05 #2

"Michael Sgier" <sg***@nospam.ch> wrote in message
news:43**********************@news.sunrise.ch...
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

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.
Aug 19 '05 #3
Michael Sgier wrote:
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

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

int x;

#ifndef x
float x;
#endif

?

It should give an error.
Aug 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Evan | last post by:
Is there any standard for when to use #if !defined(SOME_INCLUSION_GUARD) versus #ifndef SOME_INCLUSION_GUARD? Aside from being able to combine multiple things into an #if, is there any...
3
by: prettysmurfed | last post by:
Hi all I have this, probably stupid question, how to avoid multiple definitions when a header file is included more than once. I thought, when you wrote the header-file and used the...
5
by: DrUg13 | last post by:
#ifndef HEADER_H #define HEADER_H blah blal #endif So this tells the compiler That if its defined do not define it again. Could someone help me understand this. Does this mean that if I...
25
by: John Hanley | last post by:
I have a program where both my main.c and program.c files use the program.h file. So I #include "program.h" in both the .c files. The program.h file has #ifndef PROGRAM_H #define PROGRAM_H...
9
by: Qiao Jian | last post by:
I am new to c. Today I just read an h file within which there is statements: #ifndef _RANDOM_H #define _RANDOM_H So what is the meaning or purpose of this statement? When should I use such...
5
by: vfunc | last post by:
Despite a #ifndef I am getting a redefinition error The offending .h file looks like the following #ifndef DISTRIB_H #define DISTRIB_H double dblpi; // this is getting compiled twice ...
6
by: canoewhiteh2o | last post by:
I am converting a couple of C header files to C#. It is mainly just a bunch C structs but I am not sure how to handle the #ifdef and #ifndef in C#. For example: #ifndef DATE_TIME #define...
6
by: Johs | last post by:
Each time I make a new .h file in eclipse it starts with this: #ifndef FUNCS_H_ #define FUNCS_H_ // here goes all the code #endif /*FUNCS_H_*/
7
by: Studlyami | last post by:
Okay I have been wondering this for a while now. I am a little confused on the difference between these two defines #pragma once & #ifndef. From my understanding #pragma is compiler...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.