This forum has been archived. Please start a new discussion on GitHub.

slice2cpp: .cpp file includes .h file using system-style header inclusion ( < > brackets)

philip_lamb Christchurch, New Zealand

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).



  • benoit
    benoit Rennes, France


    Adding the -I<path> clang compiler option to add a header search path doesn't work? You shouldn't have to use -isystem.


  • philip_lamb
    philip_lamb Christchurch, New Zealand

    No, -I won't search local directories for <> style header inclusions by default under Clang on macOS (part of Xcode tools).

  • benoit
    benoit Rennes, France

    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/


  • philip_lamb
    philip_lamb Christchurch, New Zealand

    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.