Warning: treating 'c-header' input as 'c++-header' when in C++ mode, this behavior is deprecated

前端 未结 2 2806
花落未央
花落未央 2020-12-14 07:12

What does this clang++ error message mean, and why am I getting it? I can\'t seem to find anything on the internet about it...
clang: warning: treating \'

相关标签:
2条回答
  • 2020-12-14 07:24

    Inspire from @JoachimPileborg. The actually meaning of this error message tells is:

    You're compiling an C header file via a CXX compiler. It DOES NOT mean you CAN NOT compile the header files. you CAN compile the header file if you choose the right compiler for the right files. In simple words:

    clang   with *.h    works
    clang   with *.hpp  not works
    clang++ with *.h    not works
    clang++ with *.hpp  works
    

    So to fix the issue about compiling the header files, for example the pre-compile headers, just change the suffix from .h to .hpp will do the trick.

    0 讨论(0)
  • 2020-12-14 07:40

    You should not compile the header files, only the source files.

    0 讨论(0)
提交回复
热议问题