|
|
|
|
|
by ecuzzillo
2993 days ago
|
|
I just went through the process of making a reliable and portable PCH build process, and it's a lot of code to get right, because clang, gcc, and cl.exe all have quite different models for how a pch should work. cl.exe in particular has an insane set of requirements:
- you can't compile the pch by itself, you have to have a cpp that #include's it and compile that;
- then you have to link the resulting .obj file into the final binary;
- if you use /Zi and you compile different versions of the pch for different headers, you have to have exactly one separate .pdb file for each compiled version of the pch;
- if you have more, it will complain that some (pch, cpp) tuple do not share a .pdb;
- if you have less, it will stochastically fail to open the global pdb file (because the pch writing process expects not to have contention for the pdb, even though it's using mspdbsrv and /FS for contention) |
|