我有一个包含多个项目的Visual Studio 解决方案 :
Utils : DLL RendererEngine : DLL PhysicsEngine : DLL GameProject : EXE这里有一个模式:
渲染器和物理DLL包含Utils DLL。 除非我决定创建此GameProject(Visual Studio中的控制台应用程序项目),否则关于Visual Studio配置的一切都不是问题。 GameProject将从Renderer和Physics引擎中创建导出类的实例。
如果我想让我的GameProject 链接没有问题, 我需要包含我的Utils DLL项目的include文件夹和.lib 。 我不明白为什么。
这里的VS配置截图:
包含Conf:
Lib Conf:
是否正常,我必须在GameProject的Visual Studio配置中包含嵌套的DLL? 有没有人有类似的问题?
I have a Visual Studio Solution containing several projects:
Utils : DLL RendererEngine : DLL PhysicsEngine : DLL GameProject : EXEHere a schema :
The Renderer and Physics DLLs include the Utils DLL. Everything about the Visual Studio configuration wasn't a problem until I decide to create this GameProject (A Console Application project from Visual Studio). GameProject is going to make instance of exported classes from the Renderer and Physics engines.
If I want to make my GameProject link without a problem I need to include the include folder and .lib of my Utils DLL project. And I don't understand why.
Here the VS configuration screenshots :
Include Conf:
Lib Conf:
Is it normal that I have to make an include of a nested DLL in the Visual Studio configuration of the GameProject ? Does anyone had similar problem ?
最满意答案
如果你的程序(.exe)只使用由dll的接口声明和/或定义的东西,那么程序构建不需要知道这些dll在其实现中使用的任何东西。
但是,如果您的utils-project中的任何内容在dll的接口标题中都可见,并且您在程序代码中使用该标题,那么您的程序依赖于utils.dll。 现在你需要通知你的构建环境在哪里找东西。
具体来说:
如果您需要包含构建的utils目录,那么utils-project中的头文件将包含一个或多个 Renderer-和/或PhysicsEngine的头文件。
如果您需要为您的构建包含utils的lib文件,则会调用utils.dll 一个或多个导出函数(或导出类的方法)
解决方案:清理你的dll的接口头文件
if your program (.exe) ONLY use stuff declared and/or defined by the interfaces of the dll's then there is no need for your program-build to be aware of anything that those dll's are using in their implementations.
However if anything from your utils-project is made visible in an interface-header of either dll and you use that in your program code ,then you have a depedency from your program to the utils.dll. Now you need to inform your build environment where to find stuff.
to be concrete:
if you need to include the directory of utils for your build ,then there is a include for a header-file from the utils-project in one or more of the headers of Renderer- and/or PhysicsEngine.
if you need to include the lib-file of utils for your build ,then there is call to one or more exported functions (or methods of an exported class) of the utils.dll
Solution : sanitize the interface-header files of your dll's
更多推荐
发布评论