WinRT XAML 中的硬编码 PCH 名称 [英] Hard-coded PCH name in WinRT XAML

查看:35
本文介绍了WinRT XAML 中的硬编码 PCH 名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

WinRT 项目,C++/CX.编译我的 XAML 文件时,生成的代码文件包含一个

WinRT project, C++/CX. When my XAML files are compiled, the generated code files contain an

#include "pch.h"

#include "pch.h"

线.由于遗留代码的原因,我希望我的预编译器标头以不同的方式调用 - stdafx.h.在项目属性中更改它会影响 C++ 源,但不会影响 XAML 编译器 - 它仍会发出 pch.h 行.我在项目属性中的任何地方都找不到 XAML 编译器设置.

line. I want my precompiler header to be called differently - stdafx.h, for legacy code reasons. Changing it in project properties affects C++ sources, but not the XAML compiler - it still emits the pch.h line. I could not find XAML compiler settings anywhere in the project properties.

我该如何更改 XAML 编译器假定的 PCH 名称?

How do I change the PCH name that XAML compiler assumes, please?

推荐答案

预编译头文件的名称在 Visual Studio 2012 的 XAML 编译器中不可配置.假定为 pch.h,这是所有项目模板中文件的默认名称.

The name of the precompiled headers file is not configurable in the XAML compiler in Visual Studio 2012. It is assumed to be pch.h, which is the default name of the file in all of the project templates.

可以调整构建目标文件以禁用 XAML 生成的 C++ 源文件的预编译头文件;我对目标不是很熟悉,所以我不能肯定.或者,您可以为项目禁用预编译头文件,然后为项目中所有非生成的 C++ 源文件启用每个文件的使用.

It might be possible to tweak the build targets files to disable use of precompiled headers for XAML-generated C++ source files; I'm not that familiar with the targets, so I cannot say for sure. Alternatively, you could disable usage of precompiled headers for your project, then enable usage per-file for all of the non-generated C++ source files in the project.

如果此功能对您很重要,请考虑在 Microsoft Connect 上提出问题.

If this feature is important to you, please consider opening an issue on Microsoft Connect.

这篇关于WinRT XAML 中的硬编码 PCH 名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆