如何解决在Visual Studio 2015中从源代码构建OGRE3D时的错误

How do I resolve errors when building OGRE3D from source in Visual Studio 2015

本文关键字:源代码 构建 OGRE3D 错误 2015 Studio 何解决 解决 Visual      更新时间:2023-10-16

在CMake中从源代码构建了OGRE及其唯一的强制依赖项(FreeType解决方案)后,我该如何解决以下错误。FreeType在visualstudio2015中成功编译,但当我尝试编译OGRE时,它会出现以下错误。如能提供任何帮助,我们将不胜感激。

Severity    Code    Description Project File    Line
Warning C4251   'Ogre::DeflateStream::mCompressedStream': class 'Ogre::SharedPtr<Ogre::DataStream>' needs to have dll-interface to be used by     clients of class 'Ogre::DeflateStream'    OgreMain    C:UsersUserDesktopogre_src_v1-8-  1OgreMainincludeOgreDeflate.h  58
Warning C4251   'Ogre::DeflateStream::mReadCache': class 'Ogre::StaticCache<2048>' needs to have dll-interface to be used by clients of  class 'Ogre::DeflateStream'    OgreMain    C:UsersUserDesktopogre_src_v1-8-1OgreMainincludeOgreDeflate.h    65
Warning C4251   'Ogre::DeflateStream::mTempFileName': class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'Ogre::DeflateStream'  OgreMain    C:UsersUserDesktopogre_src_v1-8-1OgreMainincludeOgreDeflate.h    60
Warning C4251   'Ogre::DeflateStream::mTmpWriteStream': class 'Ogre::SharedPtr<Ogre::DataStream>' needs to have dll-interface to be used by clients of class 'Ogre::DeflateStream'  OgreMain    C:UsersUserDesktopogre_src_v1-8-1OgreMainincludeOgreDeflate.h    59
Error   C1083   Cannot open include file: 'zlib.h': No such file or directory   OgreMain    C:UsersUserDesktopogre_src_v1-8-1OgreMainsrcOgreDeflate.cpp  32
Error   LNK1181 cannot open input file '....libReleaseOgreMain.lib' OgrePaging  C:UsersUserDesktopOGRE2ComponentsPagingLINK  1
Error   LNK1181 cannot open input file '....libReleaseOgreMain.lib' Plugin_PCZSceneManager  C:UsersUserDesktopOGRE2PlugInsPCZSceneManagerLINK    1
Error   LNK1181 cannot open input file '....libReleaseOgreMain.lib' OgreMeshUpgrader    C:UsersUserDesktopOGRE2ToolsMeshUpgraderLINK 1
Error   LNK1181 cannot open input file '....libReleaseOgreMain.lib' OgreRTShaderSystem  C:UsersUserDesktopOGRE2ComponentsRTShaderSystemLINK  1
Error   LNK1181 cannot open input file '....libReleaseOgreMain.lib' OgreXMLConverter    C:UsersUserDesktopOGRE2ToolsXMLConverterLINK 1
Error   LNK1181 cannot open input file '....libReleaseOgreMain.lib' Plugin_BSPSceneManager  C:UsersUserDesktopOGRE2PlugInsBSPSceneManagerLINK    1
Error   LNK1181 cannot open input file '....libReleaseOgreMain.lib' Plugin_OctreeSceneManager   C:UsersUserDesktopOGRE2PlugInsOctreeSceneManagerLINK 1
Error   LNK1181 cannot open input file '....libReleaseOgreMain.lib' Plugin_ParticleFX   C:UsersUserDesktopOGRE2PlugInsParticleFXLINK 1
Error   LNK1181 cannot open input file '....libReleaseOgreMain.lib' RenderSystem_GL C:UsersUserDesktopOGRE2RenderSystemsGLLINK   1
Error   LNK1181 cannot open input file '....libReleaseOgrePaging.lib'   OgreTerrain C:UsersUserDesktopOGRE2ComponentsTerrainLINK 1
Error   LNK1181 cannot open input file '....libReleasePlugin_PCZSceneManager.lib'   Plugin_OctreeZone   C:UsersUserDesktopOGRE2PlugInsOctreeZoneLINK 1

依赖项不仅仅是FreeType。有一个官方的专用存储库,包含所有相关内容,包括zlib:

https://bitbucket.org/cabalistic/ogredeps

克隆/下载它,并确保OgreMain可以看到它,例如,将它放入Ogre源文件夹根目录中名为"Dependencies"的文件夹中。然后,它应该被常规的CMake脚本所接受。

您的OgreMain项目找不到文件zlib.h。您需要确保OgreMain的include路径中包含依赖项include目录,以便它可以定位zlib.h文件。