{
  "id": "cmake/compiler-feature-request-failed",
  "signature": "CMake Error: Feature cxx_std_17 is not available for compiler \"GNU\" version 4.8.",
  "signature_zh": "CMake 错误：功能 cxx_std_17 对编译器 \"GNU\" 版本 4.8 不可用。",
  "regex": "Feature [a-z_0-9]+ is not available for compiler \"[A-Za-z]+\" version [0-9.]+",
  "domain": "cmake",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "A target or project requests a C++ standard feature (e.g., cxx_std_17) that the installed compiler does not support due to its old version.",
  "root_cause_type": "generic",
  "root_cause_zh": "目标或项目请求了一个 C++ 标准功能（例如 cxx_std_17），但安装的编译器版本太旧，不支持该功能。",
  "versions": [
    {
      "version": "GCC 4.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "GCC 5.4",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Clang 3.5",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The compiler still does not support C++17; code using C++17 features will fail to compile with cryptic errors.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "CMake will still detect the compiler version and may produce warnings; also, compiler may not fully support C++17.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Upgrade the compiler to a version that supports C++17 (e.g., GCC 7 or later). Alternatively, set the target to a lower standard: set_target_properties(mytarget PROPERTIES CXX_STANDARD 14).",
      "success_rate": 0.95,
      "how": "Upgrade the compiler to a version that supports C++17 (e.g., GCC 7 or later). Alternatively, set the target to a lower standard: set_target_properties(mytarget PROPERTIES CXX_STANDARD 14).",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use target_compile_features(mytarget PRIVATE cxx_std_14) instead of cxx_std_17, and adjust code accordingly. Example: target_compile_features(mytarget PRIVATE cxx_std_14).",
      "success_rate": 0.9,
      "how": "Use target_compile_features(mytarget PRIVATE cxx_std_14) instead of cxx_std_17, and adjust code accordingly. Example: target_compile_features(mytarget PRIVATE cxx_std_14).",
      "condition": "",
      "sources": []
    },
    {
      "action": "If compiler upgrade is not possible, use a compatibility layer or conditionally compile C++17 features: if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 7.0) target_compile_features(mytarget PRIVATE cxx_std_17) endif().",
      "success_rate": 0.85,
      "how": "If compiler upgrade is not possible, use a compatibility layer or conditionally compile C++17 features: if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 7.0) target_compile_features(mytarget PRIVATE cxx_std_17) endif().",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "升级编译器到支持 C++17 的版本（例如 GCC 7 或更高）。或者，将目标设置为较低标准：set_target_properties(mytarget PROPERTIES CXX_STANDARD 14)。",
    "使用 target_compile_features(mytarget PRIVATE cxx_std_14) 代替 cxx_std_17，并相应调整代码。示例：target_compile_features(mytarget PRIVATE cxx_std_14)。",
    "如果无法升级编译器，使用兼容层或条件编译 C++17 特性：if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 7.0) target_compile_features(mytarget PRIVATE cxx_std_17) endif()。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://cmake.org/cmake/help/latest/manual/cmake-compile-features.7.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2024-02-28",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}