简体   繁体   English

#include-包含DirectXMath和DirectXTex时的重新定义

[英]Redefinitions when #include-ing DirectXMath and DirectXTex

Using VS2018Pro, Windows10, 使用VS2018Pro,Windows10,

I'm getting many redefinition compilation errors when pulling in DirectXTex.h, DirectXMath.h and DirectXCollision.h across project files. 在跨项目文件拉入DirectXTex.h,DirectXMath.h和DirectXCollision.h时,我收到许多重新定义编译错误。

DirectXMath and DirectXCollision are part of the Win10SDK headers and I pulled DirectXTex from the github repo and put it local to my project folder. DirectXMath和DirectXCollision是Win10SDK标头的一部分,我从github存储库中提取了DirectXTex,并将其放置在本地项目文件夹中。

In my code base I need to include the DirectXTex.h, DirectXMath.h and DirectXCollision.h headers across various files however I'm getting many redefintion errors and duplicates that are within the DirectX namespace. 在我的代码库中,我需要在各个文件中包含DirectXTex.h,DirectXMath.h和DirectXCollision.h标头,但是我收到了许多重新定义错误和DirectX名称空间中的重复项。 I understand that I may have to include one before the other (which I've tried many variations of, and DirectXTex pulls in DirectXMath for eg) but I can't get things to compile. 我知道我可能必须先添加一个(我已经尝试了很多变体,例如DirectXTex将DirectXMath引入了DirectXMath中),但是我无法进行编译。

Does anyone have a clue as to the correct order of pulling in these includes across project files? 是否有人对跨项目文件的正确提取顺序有任何线索?

解决方案是将所有“ #include DirectX * .h”标头从项目标头文件移到cpp文件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM