<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/c-26-embed-znbvse6yi" -->

---
title: C++26: #embed | daily.dev
description: C++26 introduces `#embed`, a preprocessor directive that embeds binary files directly into C++ programs as compile-time integer constant expressions. It...
canonical: https://daily.dev/posts/c-26-embed-znbvse6yi
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: C++26: #embed | daily.dev
og:description: C++26 introduces `#embed`, a preprocessor directive that embeds binary files directly into C++ programs as compile-time integer constant expressions. It...
og:url: https://daily.dev/posts/c-26-embed-znbvse6yi
og:image: https://api.daily.dev/og/posts/zNBvsE6Yi.png
og:image:alt: C++26: #embed
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# C++26: #embed

**[Sandor Dargo](https://daily.dev/sources/sandordargo)** · 7 min read · 0 upvotes · 0 comments

## Summary

C++26 introduces `#embed`, a preprocessor directive that embeds binary files directly into C++ programs as compile-time integer constant expressions. It replaces fragile build-system workarounds like `xxd -i`, `objcopy`, and custom scripts. The directive supports four parameters: `limit` (restrict byte count), `prefix`/`suffix` (wrap the embedded data), and `if_empty` (fallback for empty files). A companion `__has_embed` macro lets you conditionally embed based on resource availability. GCC 15 has full support; Clang 19+ supports it as a C23 extension. Benchmarks show dramatic compile-time improvements over xxd-generated headers — a 100 MB file embeds in ~1.3s vs 139s with the old approach.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.sandordargo.com/blog/2026/08/05/cpp26-embed>

## Similar posts on daily.dev

- [Stamping build info in constant memory](https://daily.dev/posts/stamping-build-info-in-constant-memory-v51vnrdfe) · Farid Zakaria’s Blog · 0 upvotes · 0 comments
- [Clang bytecode interpreter update](https://daily.dev/posts/clang-bytecode-interpreter-update-k6rmohzyh) · Red Hat Developer · 0 upvotes · 0 comments
- [A \_\_FILE\_\_ Macro Which Does Not Contain the Whole Source File Path](https://daily.dev/posts/a-file-macro-which-does-not-contain-the-whole-source-file-path-phx1yhylq) · Jacek Galowicz · 0 upvotes · 0 comments
- [A breakthrough in C/C\+\+ dependency management](https://daily.dev/posts/a-breakthrough-in-c-c-dependency-management-uvmknrp4g) · Lobsters · 0 upvotes · 0 comments

---

Tags: [#c++](https://daily.dev/tags/c++)

[View this post on daily.dev](https://daily.dev/posts/c-26-embed-znbvse6yi)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"C++26: #embed","url":"https://daily.dev/posts/c-26-embed-znbvse6yi","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/c-26-embed-znbvse6yi"},"datePublished":"2026-08-05T05:41:40.232Z","dateModified":"2026-08-05T05:42:01.390Z","description":"C++26 introduces `#embed`, a preprocessor directive that embeds binary files directly into C++ programs as compile-time integer constant expressions. It...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/bc56fe31dfb8fc6b112ce220016c1fe6?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/bc56fe31dfb8fc6b112ce220016c1fe6?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Sandor Dargo","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Sandor Dargo","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/48d17993e5864d66951193405fa786bb","url":"https://daily.dev/sources/sandordargo"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/c-26-embed-znbvse6yi","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"c++","timeRequired":"PT7M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Sandor Dargo","item":"https://daily.dev/sources/sandordargo"},{"@type":"ListItem","position":3,"name":"C++26: #embed"}]}
```

