Skip to content

Precompiled headers don't work on windows with ninja & msvc #1

@kterhorst

Description

@kterhorst

I tried the test case "common/13 pch" on windows with ninja & msvc and get the following error when I run ninja:

meson.py src build
...
cd build
ninja
[3/3] Linking target prog.exe
FAILED: cmd /c link /OUT:prog.exe prog.dir\prog.c.obj "/nologo"
prog.c.obj : error LNK2011: precompiled object not linked in; image may not run
prog.exe : fatal error LNK1120: 1 unresolved externals
ninja: build stopped: subcommand failed.

The problem can be fixed by manually adding the pch object file to the list of objects:

exe = executable('prog', 'prog.c',
c_pch : ['pch/prog_pch.c', 'pch/prog.h'],
objects : '../build/prog_pch.obj')

Meson should automatically add that file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions