tags:

views:

90

answers:

1

why do we get nested extern declaration warnings in c code .

A: 

You probably have include files without an include guard. That together with include files that include other include files can give your problem.

Add something like this to your include file, make sure each individual include file has a unique guard (e.g. the filename):

#ifndef MY_FILE_NAME_INCLUDE_GUARD  
#define MY_FILE_NAME_INCLUDE_GUARD  
#endif  
Putte
You need to make your inclusion guard definition unique. Add the name of the file in there, and perhaps some other identifiers The inclusion guard will not work if you try to include more than one file with the same guard definition.
A. Levy
@A. Levy, edited answer to include your good points.
Putte
And don't you ever use inclusion guard names that start with an underscore. They are reserved for the C implementation, and you in contrast are the C user.
Roland Illig
@Roland Illig, you learn something new every day, answer edited accordingly.
Putte