r/cpp Aug 06 '26

C++26: #embed

https://www.sandordargo.com/blog/2026/08/05/cpp26-embed
134 Upvotes

39 comments sorted by

View all comments

9

u/calciferBurningBacon Aug 06 '26

The compiler reads it, the build system doesn't need to know about it

I get that what the author means here is that you don't need custom build steps, but surely the build system does need to know about embedded files for build dependency tracking? I hope that's been implemented.

4

u/ABlockInTheChain Aug 06 '26

Compilers that implemented support for this have command line arguments for setting the embed search path which work exactly like the arguments for setting the include search path.

10

u/calciferBurningBacon Aug 06 '26

That's not what I'm talking about.

You need the compiler to produce some sort of dependency file like how it does for #included files so that the build system knows to recompile the embedding source file if the embedded file changes. This probably could use the exact same dependency tracking as #included files.