文件页面头部This file does not belong to any project target, code insight features might not work properly

先看整张图:
文件页面头部This file does not belong to any project target, code insight features might not work properly_第1张图片

看几个点:
1、最直观的slamBase.h头文件的文本编辑页面上方有:
This file does not belong to any project target, code insight features might not work properly
警告提示。
2、左边目录树中,include文件夹和其中的头文件slamBase.h文件都是灰色的。
3、而src文件夹和其中的文件都是彩色的。

找到如下解决方案:
https://stackoverflow.com/questions/46245738/in-clion-header-only-library-file-does-not-belong-to-any-project-target-code

原因可能就是没有关联include文件夹。

右键点击include文件夹,选择Mark Directotry as,然后选择Project Sources and Headers:
文件页面头部This file does not belong to any project target, code insight features might not work properly_第2张图片

然后报警就没有了,include文件夹和slamBase.h文件也被点亮了:
文件页面头部This file does not belong to any project target, code insight features might not work properly_第3张图片

你可能感兴趣的:(CLion使用小技巧)