You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Qt Creator编译报错:找不到bits/c++config.h文件

Fixing "bits/c++config.h: No such file or directory" in Qt Creator Android Builds

Hey there, I’ve run into this exact error before when setting up Android builds with Qt—let’s walk through the most likely fixes step by step:

  • Verify NDK-Qt Creator Compatibility
    First, double-check that your NDK version (I’m guessing android-ndk-rb16 is a typo for r16) plays nice with your Qt Creator version. Older Qt releases (like Qt 5.9-5.11) work smoothly with NDK r10e-r16, but newer Qt versions (5.12+) prefer NDK r21e or later. If your Qt is too new for r16, consider either upgrading your NDK to a compatible version or downgrading Qt to match your existing NDK.

  • Check Android Configuration in Qt Creator
    Open Qt Creator, head to Tools > Options > Devices > Android and confirm:

    • The NDK path points exactly to D:\android-ndk-r16 (no typos, no missing subfolders)
    • SDK and JDK paths are properly set and valid
      Click "Apply" and restart Qt Creator to ensure the settings take full effect.
  • Adjust STL Library Settings
    The error stems from the gnu-libstdc++ 4.9 STL, which was deprecated starting in NDK r18. Let’s switch to the recommended LLVM libc++:

    1. Open your project’s build settings (click the "Projects" tab on the left sidebar)
    2. Select your target Android kit
    3. Under "Build Environment" or "Android Build" settings, find the STL option
    4. Change it from gnustl_shared/gnustl_static to c++_shared (or c++_static if you prefer a static build)
    5. Run a full clean build: right-click your project > Clean, then Run qmake, then Build
  • Confirm NDK File Integrity
    Sometimes NDK downloads get corrupted mid-transfer. Navigate to D:\android-ndk-r16\sources\cxx-stl\gnu-libstdc++\4.9\include\bits—if c++config.h is missing here, your NDK install is incomplete. Delete the entire NDK folder and re-download it from the official archive (make sure to pick the correct Windows version).

  • Wipe Build Cache
    Corrupted build artifacts can cause weird include errors. Delete your project’s build-* folder (located in the same directory as your .pro file), then recompile from scratch.

If none of these work, drop a note with your exact Qt Creator version—I can help narrow it down further!

内容的提问来源于stack exchange,提问作者Thomas

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 08:27:44