[cfe-dev] Precompiled headers

Russell Wallace via cfe-dev cfe-dev at lists.llvm.org
Fri Dec 11 07:54:16 PST 2015


I'm having a go at using precompiled headers, but it doesn't seem to be
working. What am I doing wrong?

C:\test>type a.h
#include <iostream>
using namespace std;

C:\test>type a.cpp
#include "a.h"

int main() {
        cout << "test\n";
        return 0;
}

C:\test>clang --version
clang version 3.7.0 (tags/RELEASE_370/final)
Target: x86_64-pc-windows-msvc
Thread model: posix

C:\test>clang -fms-compatibility-version=19 -x c++-header a.h

C:\test>dir
 Volume in drive C is OS
 Volume Serial Number is C685-B1F1

 Directory of C:\test

11/12/2015  15:51    <DIR>          .
11/12/2015  15:51    <DIR>          ..
11/12/2015  15:45                67 a.cpp
11/12/2015  15:44                41 a.h
11/12/2015  15:51         4,677,904 a.h.gch
11/12/2015  15:51               250 test.bat
               4 File(s)      4,678,262 bytes
               2 Dir(s)  181,629,882,368 bytes free

C:\test>clang-cl -fms-compatibility-version=19 -Xclang -include-pch a.h.gch
a.cpp
error: invalid value 'precompiled-header' in '-x precompiled-header'
error: unable to read PCH file -o: 'no such file or directory'
error: error reading 'C:\Users\w\AppData\Local\Temp\a-1b7148.obj'
error: unable to read PCH file -o: 'no such file or directory'
fatal error: malformed or corrupted AST file: 'Unable to load module "-o":
module file not found'
4 errors generated.

C:\test>clang-cl -fms-compatibility-version=19 -Xclang -include-pch a.h
a.cpp
error: unable to read PCH file -o: 'no such file or directory'
fatal error: malformed or corrupted AST file: 'Unable to load module "-o":
module file not found'
2 errors generated.
error: unable to read PCH file -o: 'no such file or directory'
error: error reading 'C:\Users\w\AppData\Local\Temp\a-5cd097.obj'
error: unable to read PCH file -o: 'no such file or directory'
fatal error: malformed or corrupted AST file: 'Unable to load module "-o":
module file not found'
4 errors generated.

C:\test>dir
 Volume in drive C is OS
 Volume Serial Number is C685-B1F1

 Directory of C:\test

11/12/2015  15:51    <DIR>          .
11/12/2015  15:51    <DIR>          ..
11/12/2015  15:45                67 a.cpp
11/12/2015  15:44                41 a.h
11/12/2015  15:51               250 test.bat
               3 File(s)            358 bytes
               2 Dir(s)  181,634,908,160 bytes free
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151211/fb112b08/attachment.html>


More information about the cfe-dev mailing list