通过


/ifcMap

此开关告知编译器在何处查找 IFC 引用映射文件,该文件将对命名模块和标头单元的引用映射到相应的 IFC (.ifc) 文件。

语法

/ifcMap filename

注解

filename 参数指定 IFC 引用映射文件。 它可以相对于编译器的工作目录或绝对路径。

可以为编译器提供多个 /ifcMap 参数。

IFC 引用映射文件格式是 TOML 文件格式的子集。 IFC 引用映射文件可以包含混合 [[module]] 引用和 [[header-unit]] 引用。

语法错误或无法识别的表名会导致编译器错误 C7696 (TOML 分析错误)。

映射命名模块

命名模块的 IFC 引用映射文件的格式为:

# Using literal strings
[[module]]
name = 'M'
ifc = 'C:\modules\M.ifc'

# Using basic strings
[[module]]
name = "N"
ifc = "C:\\modules\\N.ifc"

此 IFC 引用映射文件将命名模块 'M' 及其 'N' 各自的 IFC 文件映射。 等效 /reference 项为:

/reference M=C:\modules\M.ifc /reference N=C:\modules\N.ifc

有关哪些类型的模块名称对 name 字段有效的详细信息,请参阅 /reference remarks

映射页眉单位

标头单元的 IFC 引用映射文件的格式为:

# Using literal strings
[[header-unit]]
name = ['quote', 'my-utility.h']
ifc = 'C:\header-units\my-utility.h.ifc'

[[header-unit]]
name = ['angle', 'vector']
ifc = 'C:\header-units\vector.ifc'

# Using basic strings
[[header-unit]]
name = ["quote", "my-engine.h"]
ifc = "C:\\header-units\\my-engine.h.ifc"

[[header-unit]]
name = ["angle", "algorithm"]
ifc = "C:\\header-units\\algorithm.ifc"

此 IFC 参考映射文件映射到"my-utility.h"C:\header-units\my-utility.h.ifc以及<vector>映射到C:\header-units\vector.ifc等。 等效 /headerUnit 项为:

/headerUnit:quote my-utility=C:\header-units\my-utility.h.ifc /headerUnit:angle vector=C:\header-units\vector.ifc /headerUnit:quote my-engine.h=C:\header-units\my-engine.h.ifc /headerUnit:angle algorithm=C:\header-units\algorithm.ifc

如果在 [[header-unit]] IFC 引用映射文件中指定,编译器将隐式启用 /Zc:preprocessor,就像使用时 /headerUnit 隐式启用一样。 有关和angle查找方法的行为quote的详细信息,请参阅 /headerUnit 备注

另请参阅

C++ 中的模块概述
演练:在 Visual C++ 项目中生成和导入标头单元
从命令行使用 MSVC 中的C++模块