Skip to content

defineCMacro not respected in included header file #19839

@actondev

Description

@actondev

Zig Version

0.12.0

Steps to Reproduce and Observed Behavior

if in build.zig you define something like exe.defineCMacro("NOCPP", "1");and the header file the youcImport` has something like

#ifndef NOCPP
namespace nsfoo {
  struct CppFoo{};
}
#endif

the compilation will fail. However, if before the cImport you use @cDefine("NOCPP", "1");, it works

Expected Behavior

I'd expect the defineCMacro to be respected

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions