# \`\`import std\`\` doesn't work on windows

**URL:** https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268
**Category:** Usage
**Tags:** os:windows, gen:ninja
**Created:** [June 20, 2025, 8:57am UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268 "2025-06-20T08:57:25Z")
**Posts on this page:** 15
**Page:** 2

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 21, 2025, 12:20pm UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/21 "2025-06-21T12:20:25Z")

</div>

so it seems, your toolchain does not support import std or is wrong installed!

Do you find `libc++.modules.json` or `libstdc++.modules.json` in `C:\dev\toolchains\llvm` tree?

---

<div class="post-metadata">

### Author: ![mccakit](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mccakit/32/5628_2.png) [@mccakit](https://discourse.cmake.org/u/mccakit)
#### Post date: [June 21, 2025, 12:25pm UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/22 "2025-06-21T12:25:15Z")

</div>

I do have `libc++.modules.json` in C:\dev\toolchains\llvm\lib\libc++.modules.json

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 21, 2025, 12:26pm UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/23 "2025-06-21T12:26:56Z")

</div>

please see [No SOURCES given to target: \_\_CMAKE\_\_CXX26 on ubuntu 25.04 - #11 by ClausKlein](https://discourse.cmake.org/t/no-sources-given-to-target-cmake-cxx26-on-ubuntu-25-04/14240/11)

you may trace `CMakeDetermineComilerId.cmake` while configure oder compile the file yourself.

---

<div class="post-metadata">

### Author: ![mccakit](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mccakit/32/5628_2.png) [@mccakit](https://discourse.cmake.org/u/mccakit)
#### Post date: [June 21, 2025, 1:06pm UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/24 "2025-06-21T13:06:06Z")

</div>

Nope, this is enough. We have gone full circle. It is the developers job to deal with this.

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 21, 2025, 6:14pm UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/25 "2025-06-21T18:14:46Z")

</div>

5 sec before the destination you give it up?

We need the output of:

```bash
/usr/local/Cellar/llvm/20.1.6/bin/clang++ -stdlib=libc++ -E -x c++-header /Users/clausklein/.local/share/cmake-4.0/Modules/CXX-DetectStdlib.h

```

or

```bash
CXX=clang++ CXXFLAGS=-stdlib=libc++ ~/.local/bin/cmake -G Ninja -S . -B build --fresh --trace-expand --trace-source=CMakeDetermineCompilerId.cmake

```

but use your right path to the your tools!

---

<div class="post-metadata">

### Author: ![mccakit](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mccakit/32/5628_2.png) [@mccakit](https://discourse.cmake.org/u/mccakit)
#### Post date: [June 21, 2025, 6:21pm UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/26 "2025-06-21T18:21:47Z")

</div>

> [@mccakit](#):
>
> `json`

Here you go, CMake 4.0.3 and clang 21 compiled from source with bin folder on PATH.  
I’m on Windows 10 and the Powershell is used in the log

[log.txt](https://discourse.cmake.org/uploads/short-url/kx0dJx7dhF5G1bZXdpRrnNllBdc.txt) (163.4 KB)

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 22, 2025, 2:38pm UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/27 "2025-06-22T14:38:21Z")

</div>

@ben.boeckel Is this a cmake or a toolchain problem?

`CMAKE-STDLIB-DETECT: UNKNOWN`

---

<div class="post-metadata">

### Author: ![mccakit](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mccakit/32/5628_2.png) [@mccakit](https://discourse.cmake.org/u/mccakit)
#### Post date: [July 9, 2025, 12:31pm UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/28 "2025-07-09T12:31:31Z")

</div>

ping @ben.boeckel

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [July 9, 2025, 4:28pm UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/29 "2025-07-09T16:28:48Z")

</div>

> [@No SOURCES given to target: \_\_CMAKE\_\_CXX26 on ubuntu 25.04](https://discourse.cmake.org/t/no-sources-given-to-target-cmake-cxx26-on-ubuntu-25-04/14240/17):
>
> Whoever packaged the compiler. If the packagers need support for their use case from the compiler, ex, they need to be able to tell the compiler “I’m going to put these files here” to make -print-file-name work, then it is on the packagers to communicate that the various compiler upstreams. The compiler upstreams can decide on a case-by-case basis if they want to support the packagers conventions, or if it is on the packagers to align themselves with the compiler’s expectations. CMake’s invol…

---

<div class="post-metadata">

### Author: ![vito.gamberini](https://discourse.cmake.org/user_avatar/discourse.cmake.org/vito.gamberini/32/4376_2.png) [@vito.gamberini](https://discourse.cmake.org/u/vito.gamberini)
#### Post date: [July 9, 2025, 4:31pm UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/30 "2025-07-09T16:31:08Z")

</div>

This is a different issue, haven’t had time to investigate

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [July 9, 2025, 4:32pm UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/31 "2025-07-09T16:32:54Z")

</div>

> [@mccakit](#):
>
> clang 21 compiled from source

who is the packager now?

---

<div class="post-metadata">

### Author: ![vito.gamberini](https://discourse.cmake.org/user_avatar/discourse.cmake.org/vito.gamberini/32/4376_2.png) [@vito.gamberini](https://discourse.cmake.org/u/vito.gamberini)
#### Post date: [July 9, 2025, 4:51pm UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/32 "2025-07-09T16:51:35Z")

</div>

> [@ClausKlein](#):
>
> who is the packager now?

mccakit is the packager, but again this is a totally unrelated issue from the problem homebrew and nix have.

---

<div class="post-metadata">

### Author: ![mccakit](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mccakit/32/5628_2.png) [@mccakit](https://discourse.cmake.org/u/mccakit)
#### Post date: [July 10, 2025, 5:44pm UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/33 "2025-07-10T17:44:39Z")

</div>

I believe there isn’t any std module detection stuff for clang in windows, regardless of toolchain because none of the other toolchains work, ndk,emcc,icx,clang-cl etc  
Currently only cl.exe works with std library modules.

---

<div class="post-metadata">

### Author: ![vito.gamberini](https://discourse.cmake.org/user_avatar/discourse.cmake.org/vito.gamberini/32/4376_2.png) [@vito.gamberini](https://discourse.cmake.org/u/vito.gamberini)
#### Post date: [July 10, 2025, 5:58pm UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/34 "2025-07-10T17:58:17Z")

</div>

Yep, fairly certain that’s correct.

Enabling P3286 metadata detection and usage, at least for clang, on Windows is on the todo list.

clang-cl is a different ballgame as it doesn’t have a single coherent story for how modules work at all right now, much less `import std`

---

<div class="post-metadata">

### Author: ![mccakit](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mccakit/32/5628_2.png) [@mccakit](https://discourse.cmake.org/u/mccakit)
#### Post date: [July 10, 2025, 5:59pm UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/35 "2025-07-10T17:59:30Z")

</div>

Good to know I wasn’t crazy. Hope it merges soon!

[Previous page](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268.md?page=1)
