cmakelists.txt上的CMAKE错误:3(项目):找不到CMAKE_CXX_COMPILER。扑面桌面

发布于 2025-02-06 15:12:27 字数 2574 浏览 3 评论 0原文

IAM试图构建一个颤抖的桌面应用程序。 我在这里遵循配置 https://docs.flutter.dev/desktop 我安装了Visual Studio 2022,并在其中添加了带有C ++的桌面开发。

但是,当我尝试运行一个桌面应用程序时,它说

CMake Error at CMakeLists.txt:3 (project):
  No CMAKE_CXX_COMPILER could be found.



Exception: Unable to generate build files

这是我的flutter医生

[√] Flutter (Channel master, 3.1.0-0.0.pre.1111, on Microsoft Windows [Version 10.0.19043.1706], locale en-US)
    • Flutter version 3.1.0-0.0.pre.1111 at E:\softwares\flutter\flutter_windows_2.0.5-stable\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 52c47e96a3 (7 days ago), 2022-06-05 08:03:02 -0400
    • Engine revision 075947bf4d
    • Dart version 2.18.0 (build 2.18.0-170.0.dev)
    • DevTools version 2.14.0

[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc3)
    • Android SDK at C:\Users\zamzam107019\AppData\Local\Android\sdk
    • Platform android-31, build-tools 31.0.0-rc3
    • Java binary at: E:\softwares\flutter\android studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.2.3)
    • Visual Studio at E:\vs community
    • Visual Studio Community 2022 version 17.2.32526.322
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2021.2)
    • Android Studio at E:\softwares\flutter\android studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19043.1706]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 102.0.5005.63
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 102.0.1245.39

[√] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

,这是导致错误的CMAKE线,

# Project-level configuration.
cmake_minimum_required(VERSION 3.14)   
project(truck_scale LANGUAGES CXX)   <---

我尝试了太多解决方案,但没有任何事情成功

Iam trying to build a flutter desktop application .
i followed the configuration here
https://docs.flutter.dev/desktop
i installed visual studio 2022 with and add Desktop development with C++ to it .

but when i tried to run a run a desktop application it said

CMake Error at CMakeLists.txt:3 (project):
  No CMAKE_CXX_COMPILER could be found.



Exception: Unable to generate build files

here is my flutter doctor

[√] Flutter (Channel master, 3.1.0-0.0.pre.1111, on Microsoft Windows [Version 10.0.19043.1706], locale en-US)
    • Flutter version 3.1.0-0.0.pre.1111 at E:\softwares\flutter\flutter_windows_2.0.5-stable\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 52c47e96a3 (7 days ago), 2022-06-05 08:03:02 -0400
    • Engine revision 075947bf4d
    • Dart version 2.18.0 (build 2.18.0-170.0.dev)
    • DevTools version 2.14.0

[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc3)
    • Android SDK at C:\Users\zamzam107019\AppData\Local\Android\sdk
    • Platform android-31, build-tools 31.0.0-rc3
    • Java binary at: E:\softwares\flutter\android studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.2.3)
    • Visual Studio at E:\vs community
    • Visual Studio Community 2022 version 17.2.32526.322
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2021.2)
    • Android Studio at E:\softwares\flutter\android studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19043.1706]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 102.0.5005.63
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 102.0.1245.39

[√] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

and this is the cmake line that cause the error

# Project-level configuration.
cmake_minimum_required(VERSION 3.14)   
project(truck_scale LANGUAGES CXX)   <---

i tried too many solution but no thing succeeded

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

几味少女 2025-02-13 15:12:27

当我使用C ++和安装Windows 10 SDK 10.0.20348.0 而不是 10.0.19041.0

“

It solved when i modified Desktop development with C++ and installed Windows 10 SDK 10.0.20348.0 instead of 10.0.19041.0

Visual Studio installer modification

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文