Archived
slice2cpp: .cpp file includes .h file using system-style header inclusion ( < > brackets)
The auto-generated cpp file output by slice2cpp includes its header using system-style header inclusion ( < > brackets). This causes problems when compiled via clang, as clang expects user headers to be included via quotes only.
Two workarounds:
1. Manually edit the .cpp file after every time slice2cpp is run.
2. Specify the directory holding the .h file as a system header path to clang (with -isystem command line option).
Comments
-
Hi,
Adding the
-I<path>
clang compiler option to add a header search path doesn't work? You shouldn't have to use-isystem
.Cheers,
Benoit.0 -
No, -I won't search local directories for <> style header inclusions by default under Clang on macOS (part of Xcode tools).
0 -
Hi Philip,
Which clang version do you use?
It works for me with clang form the command line tools:
$ mkdir -p include/A $ touch include/A/A.h $ echo "#include <A/A.h>" > foo.c $ clang -c foo.c foo.c:1:10: fatal error: 'A/A.h' file not found #include <A/A.h> ^~~~~~~ 1 error generated. $ clang -Iinclude -c foo.c $ clang -v Apple LLVM version 9.0.0 (clang-900.0.38) Target: x86_64-apple-darwin16.7.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Cheers,
Benoit.0 -
Sorry for the late reply. I have the same version. I should have clarified that this is when being included as part of an Xcode project. I suppose Xcode is overriding some setting to do with Clang's inclusions, but I haven't found what yet.
0