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

时间:2016-01-02 06:52:22

标签: c++ visual-c++ visual-studio-2015 ogre

如何从源代码中在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

2 个答案:

答案 0 :(得分:3)

除了FreeType之外,还有更多依赖项。有一个官方的专用存储库,包含所有相关的,包括zlib:

https://bitbucket.org/cabalistic/ogredeps

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

答案 1 :(得分:0)

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