Clion this file does not belong to any project target错误

在CLion多文件编程,c++编程添加头文件时,运行时报错
Clion this file does not belong to any project target错误

在对应头文件的.cpp文件中出现 This file does not belong to any project ,code insight features might not work properly 提示

意思是: 此文件不属于任何项目,代码洞察功能可能无法正常工作

就是main程序添加这个头文件无效
Clion this file does not belong to any project target错误

解决方法在 CMakeLists.txt中添加 对应文件

在 add_executable(项目名 文件2.cpp 文件2.cpp),运行程序,问题解决。
Clion this file does not belong to any project target错误

相关文章:

  • 2022-12-23
  • 2021-08-08
  • 2021-05-18
  • 2021-07-06
  • 2021-04-29
  • 2021-12-29
  • 2021-04-15
  • 2022-12-23
猜你喜欢
  • 2021-10-05
  • 2021-07-25
  • 2021-05-26
  • 2021-09-26
  • 2021-10-25
  • 2021-09-09
相关资源
相似解决方案