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

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

我如何解决以下错误,从源代码在 CMake 中构建了 OGRE 及其唯一的强制依赖项(FreeType 解决方案)。 FreeType 在 visual studio 2015 中编译成功,但是当我尝试编译 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:\Users\User\Desktop\ogre_src_v1-8-  1\OgreMain\include\OgreDeflate.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:\Users\User\Desktop\ogre_src_v1-8-1\OgreMain\include\OgreDeflate.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:\Users\User\Desktop\ogre_src_v1-8-1\OgreMain\include\OgreDeflate.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:\Users\User\Desktop\ogre_src_v1-8-1\OgreMain\include\OgreDeflate.h    59
Error   C1083   Cannot open include file: 'zlib.h': No such file or directory   OgreMain    C:\Users\User\Desktop\ogre_src_v1-8-1\OgreMain\src\OgreDeflate.cpp  32
Error   LNK1181 cannot open input file '..\..\lib\Release\OgreMain.lib' OgrePaging  C:\Users\User\Desktop\OGRE2\Components\Paging\LINK  1
Error   LNK1181 cannot open input file '..\..\lib\Release\OgreMain.lib' Plugin_PCZSceneManager  C:\Users\User\Desktop\OGRE2\PlugIns\PCZSceneManager\LINK    1
Error   LNK1181 cannot open input file '..\..\lib\Release\OgreMain.lib' OgreMeshUpgrader    C:\Users\User\Desktop\OGRE2\Tools\MeshUpgrader\LINK 1
Error   LNK1181 cannot open input file '..\..\lib\Release\OgreMain.lib' OgreRTShaderSystem  C:\Users\User\Desktop\OGRE2\Components\RTShaderSystem\LINK  1
Error   LNK1181 cannot open input file '..\..\lib\Release\OgreMain.lib' OgreXMLConverter    C:\Users\User\Desktop\OGRE2\Tools\XMLConverter\LINK 1
Error   LNK1181 cannot open input file '..\..\lib\Release\OgreMain.lib' Plugin_BSPSceneManager  C:\Users\User\Desktop\OGRE2\PlugIns\BSPSceneManager\LINK    1
Error   LNK1181 cannot open input file '..\..\lib\Release\OgreMain.lib' Plugin_OctreeSceneManager   C:\Users\User\Desktop\OGRE2\PlugIns\OctreeSceneManager\LINK 1
Error   LNK1181 cannot open input file '..\..\lib\Release\OgreMain.lib' Plugin_ParticleFX   C:\Users\User\Desktop\OGRE2\PlugIns\ParticleFX\LINK 1
Error   LNK1181 cannot open input file '..\..\lib\Release\OgreMain.lib' RenderSystem_GL C:\Users\User\Desktop\OGRE2\RenderSystems\GL\LINK   1
Error   LNK1181 cannot open input file '..\..\lib\Release\OgrePaging.lib'   OgreTerrain C:\Users\User\Desktop\OGRE2\Components\Terrain\LINK 1
Error   LNK1181 cannot open input file '..\..\lib\Release\Plugin_PCZSceneManager.lib'   Plugin_OctreeZone   C:\Users\User\Desktop\OGRE2\PlugIns\OctreeZone\LINK 1

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

有比 FreeType 更多的依赖项。有一个官方的专用存储库,其中包含所有相关内容,包括 zlib:

https://bitbucket.org/cabalistic/ogredeps

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