[cfe-dev] Precompiled headers
Richard Smith via cfe-dev
cfe-dev at lists.llvm.org
Fri Dec 11 10:26:57 PST 2015
On Dec 11, 2015 7:54 AM, "Russell Wallace via cfe-dev" <
cfe-dev at lists.llvm.org> wrote:
>
> 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
-Xclang passes only the immediately following argument to cc1. You need
clang-cl -fms-compatibility-version=19 -Xclang -include-pch -Xclang a.h.gch
a.cpp
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.)
> 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
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151211/97b129ab/attachment.html>
More information about the cfe-dev
mailing list