I have this cpp file where I include bunch of C files.
main.cpp
extern "C" {
#include "types.h"
#include "file1.h"
}
...
types.h
#IFNDEF TYPES_H
#DEFINE TYPES_H
typedef unsigned short int char16;
...
#ENDIF // TYPES_H
file1.h
#include "file2.h"
...
file2.h
...
char16* testCode();
...
For some reason the compiler gives me an error that the char16 is not declared. Any idea why the include does not inheritate from the CPP file to the C-file? Any help is appreciated. Thanks!
You should include the types.h in file2.h. You don’t seem to be doing that.
Btw, the code posted compiles on my machine without any errors, whereas if I comment the
"#include "types.h"in main.cpp, it gives me an error.