Sep 21, 2013 at 3:55am UTC
I have a.h as follows
1 2 3 4 5 6 7 8
namespace one{
namespace two{
enum Filter {
GRAPE, COSINE, SYNC
};
}
}
If I do this in another header file b.h
1 2 3 4 5 6 7
#include <one/two/a.h>
namespace one {
namespace three {
}
}
I get error 'n' does not name a type.
Please, kindly help
Last edited on Sep 21, 2013 at 4:01am UTC
Sep 21, 2013 at 4:34am UTC
Last edited on Sep 21, 2013 at 4:35am UTC
Sep 21, 2013 at 6:41am UTC
Thanks JLBorge.
I tried your suggestion modifying the include directives for a.h in b.h and by adding the guard in a.h as follows
1 2 3 4 5 6 7 8 9 10 11 12 13
// guard
#ifndef A_H
#define A_H
namespace one{
namespace two{
enum Filter {
GRAPE, COSINE, SYNC
};
}
}
#endif
With the above I get
error: expected unqualified-id before '/' token
for the comment above the guard
And
error: 'i' does not name a type
for the 'i' in ifndef
Last edited on Sep 21, 2013 at 6:47am UTC
Sep 21, 2013 at 7:16am UTC
I saw the culprit.
I copied the source to a text editor, saved and everything was fine.
Apparently, some weird characters were been attached automatically somewhere.