Repository navigation
Conversation
`wit.h` is emitted into the output directory of every generated set of bindings. When two such directories are on the include path, `#pragma once` does not prevent the second copy from being processed, as the files are different, which results in redefinition errors. Add a classic include guard in addition. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| @@ -1,4 +1,6 @@ | |||
| #pragma once | |||
Member
There was a problem hiding this comment.
Is the #pragma once still necessary with an ifdef guard?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
wit.his emitted into the output directory of every set of generated C++bindings. If two such directories are on the include path (for example when a
component uses the bindings of several worlds),
#pragma oncedoes not stopthe second copy from being parsed, as it is a different file, and the types in
wit.hare redefined. Add a classicWIT_BINDGEN_WIT_H_DEFINEDinclude guardnext to
#pragma once.Tested with
cargo run -- test --languages rust,c,cpp ... tests/runtime/simple-future tests/runtime/strings.