locked
Generated files using incorrect precompiled header file

    Question

  • I've got a Metro app which uses Xaml, and one of the files it auto-generates is xamltypeinfo.impl.g.cpp.  I have specified in the project properties -> C/C++ -> Precompiled Headers -> Precompiled Header File = "StdAfx.h", however xamltypeinfo.impl.g.cpp is trying to use "pch.h" for its precompiled header.  How do I fix this conflict?

    What is the process which goes into generating this file? Since it seems to be ignoring the project property, is there a template with a hardcoded "pch.h" somewhere I need to change?

    \generated files\xamltypeinfo.imp.g.cpp(9): warning C4627: '#include "pch.h"': skipped when looking for precompiled header use
    \generated files\xamltypeinfo.imp.g.cpp(506): fatal error C1010: unexpected end of file while looking for precompiled header.  Did you forget to add '#include "StdAfx.h"' to your source?


    Wednesday, September 12, 2012 4:25 PM

All replies

  • Hi,

    What's the version of your Visual Studio, and how to reproduce this issue?

    We would suggest you to create Windows store app with the template in Visual Studio.

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, September 13, 2012 6:42 AM
  • VS2012 Pro 11.0.50727.1 RTMREL

    Win 8 RTM - 9200

    Steps to reproduce

    1. Create new project->Visual c++ -> Windows Store -> Blank app (Xaml)
    2. Search and replace "pch.h" with "StdAfx.h"
    3. Rename pch.h and pch.cpp to StdAfx.h and StdAfx.cpp
    4. Set project properties -> C/C++ -> Precompiled Headers -> Precompiled Header File = "StdAfx.h"
    5. Attempt to compile

    I've also attached a sample project at this location

    https://connect.microsoft.com/VisualStudio/feedback/details/762351/generated-files-using-incorrect-precompiled-header-file


    • Edited by mwinn1 Thursday, September 13, 2012 3:46 PM Adding more version info
    Thursday, September 13, 2012 3:40 PM
  • Hello,

     

    Thanks for your feedback.

     

    Best regards,

    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Friday, September 14, 2012 2:49 AM
  • Unfortunately, "Thanks for your feedback" is not the response I'm looking for.  Let me ask this question again.

    What is the process which goes into generating this file? Since it seems to be ignoring the project property, is there a template with a hardcoded "pch.h" somewhere I need to change?

    Monday, September 24, 2012 4:38 PM
  • You can find the templates in your Visual Studio install dir under Common7\IDE\ItemTemplates\VC\WindowsStore. You can make a copy elsewhere and update the hardcoded #include "pch.h" lines.

    See Introduction to Visual Studio Templates for more information.

    --Rob

    Monday, September 24, 2012 9:06 PM
    Owner
  • I think the directory you've pointed me to are the templates used when you create a new project, but that's not what I'm looking for.  "XamlTypeInfo" is not part of this directory nor any of its file contents.  xamltypeinfo.imp.g.cpp seems to be one of the files generated at compile time, but I can do a full text search of the "Microsoft Visual Studio 11.0" directory and not find any reference of it.

    Monday, September 24, 2012 9:36 PM
  • Here is an idea:-

    You can disable pre-compiled header file by following these steps:-

    Right click on your project -> Properties -> Configuration properties -> C/C++ -> precompiled headers -> click no precompiled headers.

    Then go to your project in header files folder. Right click and add header file "stdafx.h" and include them to main source file...

    As per my knowledge, the precompiled headers tend to give problems while running bigger projects.

    Monday, February 3, 2014 9:23 AM