TGViewer
C++ - Reddit C++ - Reddit @r_cpp · 230 subscribers
Post #25192 15
Encountered a #pragma once failure in the wild

A header-only C++ library, headers guarded by #pragma once. We use relative includes internally. We also ship compiled WASM bindings for TypeScript.

A dockerised emscripten build on Apple Silicon under linux/amd64 emulation, the repo mounted in as a bind volume. Every translation unit reports redefinition errors: the same headers included multiple times in a single TU.

#pragma once dedupes by file identity; inode and device, in practice. On a bind mount under amd64 emulation on macOS, the same file reached through different ..-laden relative paths is not always recognised as the same file. The pragma never fires.

The problem goes away if you copy the source files into the container.

https://redd.it/1tcxu2s
@r_cpp
Reddit From the cpp community on Reddit Explore this post and more from the cpp community
More from @r_cpp
  1. Oct 3, 2026C++ future at Adobe So if anyone was still curious what happened to Hylo, or where Adobe s…
  2. Oct 3, 2026C++ Jobs - Q4 2026 Rules For Individuals --------------------- * **Don't** create top-leve…
  3. Sep 29, 2026Boost.Graph 1.95 will be C++17 Dear Boost.Graph community, In two release cycles (Boost re…
  4. Sep 26, 2026Token Sequence Injection & Modern Macros: The Most Game-Changing Compile-Time Feature in C…
  5. Sep 25, 2026myStringStream.str("") Considered Harmful Under C++20 I was recently looking at some (rath…
  6. Sep 20, 2026A clever branch free optimization I'm the developer of memlz which is an extremely fast co…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →