<p dir="ltr">On Dec 11, 2015 7:54 AM, "Russell Wallace via cfe-dev" <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br>
><br>
> I'm having a go at using precompiled headers, but it doesn't seem to be working. What am I doing wrong?<br>
><br>
> C:\test>type a.h<br>
> #include <iostream><br>
> using namespace std;<br>
><br>
> C:\test>type a.cpp<br>
> #include "a.h"<br>
><br>
> int main() {<br>
>         cout << "test\n";<br>
>         return 0;<br>
> }<br>
><br>
> C:\test>clang --version<br>
> clang version 3.7.0 (tags/RELEASE_370/final)<br>
> Target: x86_64-pc-windows-msvc<br>
> Thread model: posix<br>
><br>
> C:\test>clang -fms-compatibility-version=19 -x c++-header a.h<br>
><br>
> C:\test>dir<br>
>  Volume in drive C is OS<br>
>  Volume Serial Number is C685-B1F1<br>
><br>
>  Directory of C:\test<br>
><br>
> 11/12/2015  15:51    <DIR>          .<br>
> 11/12/2015  15:51    <DIR>          ..<br>
> 11/12/2015  15:45                67 a.cpp<br>
> 11/12/2015  15:44                41 a.h<br>
> 11/12/2015  15:51         4,677,904 a.h.gch<br>
> 11/12/2015  15:51               250 test.bat<br>
>                4 File(s)      4,678,262 bytes<br>
>                2 Dir(s)  181,629,882,368 bytes free<br>
><br>
> C:\test>clang-cl -fms-compatibility-version=19 -Xclang -include-pch a.h.gch a.cpp<br>
> error: invalid value 'precompiled-header' in '-x precompiled-header'<br>
> error: unable to read PCH file -o: 'no such file or directory'<br>
> error: error reading 'C:\Users\w\AppData\Local\Temp\a-1b7148.obj'<br>
> error: unable to read PCH file -o: 'no such file or directory'<br>
> fatal error: malformed or corrupted AST file: 'Unable to load module "-o": module file not found'<br>
> 4 errors generated.<br>
><br>
> C:\test>clang-cl -fms-compatibility-version=19 -Xclang -include-pch a.h a.cpp</p>
<p dir="ltr">-Xclang passes only the immediately following argument to cc1. You need</p>
<p dir="ltr">clang-cl -fms-compatibility-version=19 -Xclang -include-pch -Xclang a.h.gch a.cpp</p>
<p dir="ltr">Also, the -Xclang / -cc1 interface is not really supported and has no stability guarantees; do the cl.exe flags for PCH not work in clang-cl? (If not, please file a bug on that.)</p>
<p dir="ltr">> error: unable to read PCH file -o: 'no such file or directory'<br>
> fatal error: malformed or corrupted AST file: 'Unable to load module "-o": module file not found'<br>
> 2 errors generated.<br>
> error: unable to read PCH file -o: 'no such file or directory'<br>
> error: error reading 'C:\Users\w\AppData\Local\Temp\a-5cd097.obj'<br>
> error: unable to read PCH file -o: 'no such file or directory'<br>
> fatal error: malformed or corrupted AST file: 'Unable to load module "-o": module file not found'<br>
> 4 errors generated.<br>
><br>
> C:\test>dir<br>
>  Volume in drive C is OS<br>
>  Volume Serial Number is C685-B1F1<br>
><br>
>  Directory of C:\test<br>
><br>
> 11/12/2015  15:51    <DIR>          .<br>
> 11/12/2015  15:51    <DIR>          ..<br>
> 11/12/2015  15:45                67 a.cpp<br>
> 11/12/2015  15:44                41 a.h<br>
> 11/12/2015  15:51               250 test.bat<br>
>                3 File(s)            358 bytes<br>
>                2 Dir(s)  181,634,908,160 bytes free<br>
><br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
><br>
</p>