# How to use \`zig cc\` without generating a .pdb file?

**URL:** <https://ziggit.dev/t/how-to-use-zig-cc-without-generating-a-pdb-file/2873>\
**Category:** Help\
**Tags:** c\
**Created:** [January 15, 2024, 9:26pm UTC](https://ziggit.dev/t/how-to-use-zig-cc-without-generating-a-pdb-file/2873 "2024-01-15T21:26:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![raised\_error](https://ziggit.dev/user_avatar/ziggit.dev/raised_error/32/1534_2.png) [@raised\_error](https://ziggit.dev/u/raised_error)\
**Post date:** [January 15, 2024, 9:26pm UTC](https://ziggit.dev/t/how-to-use-zig-cc-without-generating-a-pdb-file/2873/1 "2024-01-15T21:26:07Z")

</div>

I am trying to create a transpiler that 1) reads source code in a syntax invented by myself, 2) generates C code, and then 3) passes the generated C code via stdin to execution of a `zig cc ...` command.

Unfortunately, that `zig cc` generates not only an `.exe` file but also `.pdb` file (!?). I wonder if the `.pdb` file can be disabled in any way, for example with a magic CLI flag set in front of the `zig cc` command, with a magic environment variable, by instead using `zig build-exe ...` with flags to compile the C code via stdin, or some other way. In sum, I am trying to find a painless way of integrating `zig cc` as a backend C compiler for my transpiler.

Reproducing this can be done as follows:

```shell
> # Write a hello world program into a .c file. For example:
> cat .\hello_world.c
#include <stdio.h>

int main(void) {
    printf("hello, world\n");
}
> # Then, compile it by piping it into a `zig cc` command:
> cat .\hello_world.c | zig cc -x c - -Wall -Wextra -o hello_world.exe

```

And then, I get the following new files in my current working directory: `hello_world.exe`; and `hello_world.pdb`.

What can I do differently so that the `.pdb` file does not appear?

---

<div class="post-metadata">

**Author:** ![nullptrdevs](https://ziggit.dev/user_avatar/ziggit.dev/nullptrdevs/32/1323_2.png) [@nullptrdevs](https://ziggit.dev/u/nullptrdevs)\
**Post date:** [January 15, 2024, 10:02pm UTC](https://ziggit.dev/t/how-to-use-zig-cc-without-generating-a-pdb-file/2873/2 "2024-01-15T22:02:52Z")

</div>

try

```zig
short, long desc
-s, -Wl,--strip-all Strip all symbols
-S, -Wl,--strip-debug Strip debugging symbol

```

---

<div class="post-metadata">

**Author:** ![raised\_error](https://ziggit.dev/user_avatar/ziggit.dev/raised_error/32/1534_2.png) [@raised\_error](https://ziggit.dev/u/raised_error)\
**Post date:** [January 17, 2024, 5:03pm UTC](https://ziggit.dev/t/how-to-use-zig-cc-without-generating-a-pdb-file/2873/3 "2024-01-17T17:03:12Z")

</div>

Hi @nullptrdevs . Thanks for these suggestions. Unfortunately, none works perfectly.

`-s` generates an .exe without generating a .pdb and the generated .exe runs fine. However, the compilation is noticeably slower than mingw-w64’s C compiler, and some messages (e.g. mingw-w64 msvcrt-os.lib… ) flash up on the terminal and then disappear.

`-S` generates an .exe without generating a .pdb, but the generated .exe doesn’t run.

`-Wl`, `--strip-all`, and `--strip-debug` are not available CLI options in `zig cc`.

---

<div class="post-metadata">

**Author:** ![dimdin](https://ziggit.dev/user_avatar/ziggit.dev/dimdin/32/1457_2.png) [@dimdin](https://ziggit.dev/u/dimdin)\
**Post date:** [January 17, 2024, 6:17pm UTC](https://ziggit.dev/t/how-to-use-zig-cc-without-generating-a-pdb-file/2873/4 "2024-01-17T18:17:42Z")

</div>

Welcome @raised_error ,

Linker accepts the option /pdb:/path/to/pdb/file.  
zig cc accepts the flag -Xlinker to send a flag to the linker.  
Together:

```zig
zig cc -target x86_64-windows t.c -Xlinker /pdb:/dev/null -o t.exe

```

Please note that without pdb you will not have function names and source lines on your crash stack traces.

---

<div class="post-metadata">

**Author:** ![nikita-edel](https://ziggit.dev/user_avatar/ziggit.dev/nikita-edel/32/9210_2.png) [@nikita-edel](https://ziggit.dev/u/nikita-edel)\
**Post date:** [June 23, 2026, 7:38pm UTC](https://ziggit.dev/t/how-to-use-zig-cc-without-generating-a-pdb-file/2873/5 "2026-06-23T19:38:39Z")

</div>

zig cc -s hello\_world.c  
-s tells zig to strip debug symbols, which on windows prevents outputting .pdb
