# add support for compiling Objective-C\+\+ code \(\#10096\) · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/9836f1b2f975cc484499847225eeb0ad54116942)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 9836f1b2f975cc484499847225eeb0ad54116942

Requested commit: 9836f1b2f975cc484499847225eeb0ad54116942

Commit: 9836f1b2f975cc484499847225eeb0ad54116942

Tree: bb8bf2340fc4045f571d323d56e13c48d0524ef5

Author: Stephen Gutekanst

Committer: GitHub

## Message

```
add support for compiling Objective-C++ code (#10096)

* add support for compiling Objective-C++ code

Prior to this change, calling `step.addCSourceFiles` with Obj-C++ file extensions
(`.mm`) would result in an error due to Zig not being aware of that extension.
Clang supports an `-ObjC++` compilation mode flag, but it was only possible to use
if you violated standards and renamed your `.mm` Obj-C++ files to `.m` (Obj-C) to
workaround Zig being unaware of the extension.

This change makes Zig aware of `.mm` files so they can be compiled, enabling compilation
of projects such as [Google's Dawn WebGPU](https://dawn.googlesource.com/dawn/) using
a `build.zig` file only.

Helps hexops/mach#21

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>

* test/standalone: add ObjC++ compilation/linking test

Based on the existing objc example, just tweaked for ObjC++.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
```

## Parents

- [722c6b95671fcda0da1561205e487d169c046473](https://git.cafe/gitcafe/zig/commit/722c6b95671fcda0da1561205e487d169c046473?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/9836f1b2f975cc484499847225eeb0ad54116942?format=markdown)
