c++ - CLion 的 CMake 问题 - 错误 :Cannot determine link language for target "XYZ"

标签 c++ cmake clion

启动 CLion 输出以下内容:

Error:Cannot find source file:
  sinclude/MathCompiler.h
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx
Error:CMake can not determine linker language for target: MathCompiler
Error:Cannot determine link language for target "MathCompiler".
Warning:Configuration Debug
Unable to determine product file path for target MathCompiler (Debug). Running and debugging will be unavailable.
Warning:Configuration Release
Unable to determine product file path for target MathCompiler (Release). Running and debugging will be unavailable.
Warning:Configuration RelWithDebInfo
Unable to determine product file path for target MathCompiler (RelWithDebInfo). Running and debugging will be unavailable.
Warning:Configuration MinSizeRel
Unable to determine product file path for target MathCompiler (MinSizeRel). Running and debugging will be unavailable.

自上次构建以来我没有做任何更改。

这是CMakeLists.txt

cmake_minimum_required(VERSION 3.3)
project(MathCompiler)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

set(SOURCE_FILES main.cpp cpp/MathCompiler.cpp include/MathCompiler.h cpp/MathException.cpp include/MathException.h cpp/MathematicString.cpp include/MathematicString.h include/str_cmp.h include/typedefs.h)
add_executable(MathCompiler ${SOURCE_FILES})

最佳答案

.h 文件通常不包含在源文件列表中

关于c++ - CLion 的 CMake 问题 - 错误 :Cannot determine link language for target "XYZ",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32848803/

相关文章:

c++ - 如何在不指定维度的情况下用 Eigen 声明张量?

c++ - 在主函数之外退出程序

c++ - CLion 重命名头文件

c++ - 将不带复制构造函数的类的成员函数指针传递给 Fortran

c++ - 包含二维数组的类的运算符重载

c++ - 将 CMake 与多个编译器一起用于同一语言

C++ 如何将 boost 库与我的共享库链接以在目标机器上工作?

Android Studio Cmake 无法确定目标的链接器语言

c++ - 在 CLion 中调试时如何切换到 cmd/powershell?

c++ - 使用 Clion 的 C++ 简单程序 "expected ` ,' or ` .. .' before ' & &' token"