怎样在Windows下编译OpenVRML

<p class="wikipage searchable">参考原文:<a href="https://sourceforge.net/apps/trac/openvrml/wiki/BuildOpenvrmlOnWindows">https://sourceforge.net/apps/trac/openvrml/wiki/BuildOpenvrmlOnWindows</a>
</p>
<p class="wikipage searchable">Original version copyright (C) Zack Smith 2008</p>
<p class="wikipage searchable">今天花了一整天的时候配置编译环境并编译,尽管仍未编译成功,但已将错误减少至两处,而且这剩下的两处也应该是我对VC不了解而出现的,希望能很快解决。 注:build在文中被译作构建,可能有点别扭。。。</p>
<h2 id="a1.ObtainOpenVRML" class="wikipage searchable">1. 获取OpenVRML</h2>
<p class="wikipage searchable">从<a href="http://openvrml.org/download">http://openvrml.org/download</a>
获取OpenVRML 分发 (发行包或Subversion处最新源码) 。</p>
<h2 id="a2.DownloadVisualCExpress" class="wikipage searchable">2. 下载Visual C++ Express</h2>
<p class="wikipage searchable">如果你还没有微软的编译器,你可以使用免费版 <a class="ext-link" href="http://www.microsoft.com/express/vc/"><span class="icon">Visual C++ Express</span>
</a>
。</p>
<h2 id="a3.InstalltheprecompiledBoostClibraries" class="wikipage searchable">3. 安装预编译的 Boost C++ 库</h2>
<p class="wikipage searchable">用 <a class="ext-link" href="http://www.boostpro.com/"><span class="icon">BoostPro Computing</span>
</a>
的 <a class="ext-link" href="http://www.boostpro.com/products/free"><span class="icon">freely available installer</span>
</a>
来构建Windows下的Boost。</p>
<p class="wikipage searchable">至少要为最新版本的Microsoft Visual C++ 编译器(当前为9.0)安装"Multithread" 和 "Multithread Debug"变体的库。注:这个工具可以根据需要下载源文件和预编译的库文件,根据后面编译的情况来看,应该还要选date_time、system、thread等。</p>
<blockquote class="wikipage searchable">
<p>The installers for versions 1.37.0 and 1.38.0 appear to have a glitch such that checking the boxes to install the variants globally for all libraries may not actually result in that selection propagating to the individual libraries. Make sure that you expand the tree of available variants to install and specifically check the "Multithread" and "Multithread Debug" variants.</p>
</blockquote>
<h2 id="a4.Openthesolutionfile" class="wikipage searchable">4. 打开解决方案文件</h2>
<p class="wikipage searchable">Visual C++ 9.0 的解决方案文件可以在OpenVRML的如下目录找到</p>
<div class="wikipage searchable">
<textarea readonly class="wiki">ide-projects/Windows/VisualC9_0/OpenVRML/OpenVRML.sln
</textarea>
</div>
<h2 id="a5.AddtheBoostheaderandlibrarydirectoriestothecompilerspathlists" class="wikipage searchable">5. 将Boost头文件和库目录添加到编译器的路径列表</h2>
<p class="wikipage searchable">OpenVRML 依赖于很多库 - 每一个都要单独下载,并且必须要将它们的include和library目录添加到Visual C++路径列表中。下面的步骤阐明了如何添加到路径列表。</p>
<div class="wikipage searchable">
<ol>
<li>选择工具 -> 选项下拉菜单</li>
<li>在"项目和解决方案"中,选择"VC++目录",然后"包含文件"</li>
<li>点击文件夹图标,添加带版本号的boost目录到路径中。它应该类似于这样:
<textarea readonly class="wiki">C:/Program Files/boost/boost_1_38_0
<img src="https://p-blog.csdn.net/images/p_blog_csdn_net/x3dcn/EntryImages/20090920/vc_boost.jpg" alt="vc_boost.jpg"></textarea>
</li>
<li>现在再选择"库文件"
</li>
<li style=""><img src="https://p-blog.csdn.net/images/p_blog_csdn_net/x3dcn/EntryImages/20090920/vc_boost_lib.jpg" alt="vc_boost_lib.jpg"></li>
<li>点击文件夹图标添加路径,看起来应该像这样:
<textarea readonly class="wiki">C:/Program Files/boost/boost_1_38_0/lib
</textarea>
</li>
</ol>
</div>
<h2 id="a6.BuildFreeType">6. 构建 FreeType</h2>
<ol>
<li>下载zip文件格式的FreeType分发,从 <a class="ext-link" href="http://sourceforge.net/project/showfiles.php?group_id=3157&package_id=3121"><span class="icon">the FreeType SourceForge project's file releases</span>
</a>
。</li>
<li>在Visual C++中打开解决方案文件。可以在FreeType的<span style="font-family: Courier New;">builds/win32/vc2008</span>
目录下找到。</li>
<li>选择freetype项目中的"LIB Release Multithreaded" 与 "LIB Debug Multithreaded"配置进行构建。</li>
<li>FreeType解决方案会输出所有的库到同样的目录下,<tt>objs/win32/vc2008</tt>
.(提一下,个别的路径可能根据所用的编译版本而有所不同) 。将该目录添加到VS的库目录下。形式如下:
<textarea readonly class="wiki">C:/Users/Joe/freetype-2.3.9/objs/win32/vc2008
</textarea>
</li>
<li>将FreeType的include子目录添加到VS的包含文件目录。形式如下:
<textarea readonly class="wiki">C:/Users/Joe/freetype-2.3.9/include
</textarea>
</li>
</ol>
<h2 id="a7.Buildlibpng">7. 构建 libpng</h2>
<ol>
<li>从<a class="ext-link" href="http://sourceforge.net/project/showfiles.php?group_id=5624"><span class="icon">libpng SourceForge project's file releases</span>
</a>
下载最新版本的libpng及zlib分发的zip文件。</li>
<li>解压libpng后,将zlib的内容解压到与libpng同一级目录下的"zlib"文件夹。利润,如果你的libpng放在<span style="font-family: Courier New;">C:/Users/Joe/lpng1235</span>
,你的zlib就应该放在<span style="font-family: Courier New;">C:/Users/Joe/zlib</span>
。注意尽管libpng的zip文件包含了顶级目录,但zlib到目前1.2.3版本为止未包括。</li>
<li>在Visual C++中打开libpng解决方案文件。可以在libpng的<span style="font-family: Courier New;">projects/visualc71/libpng.sln</span>
找到。</li>
<li>按照 libpng 项目的"LIB Debug" 和 "LIB Release"配置进行构建。zlib会自动作为依赖被构建。</li>
<li>将libpng的输出目录添加到Visual C++的库目录列表。形式如下:
<textarea readonly class="wiki">C:/Users/Joe/lpng1235/projects/visualc71/Win32_LIB_Debug
C:/Users/Joe/lpng1235/projects/visualc71/Win32_LIB_Release
</textarea>
</li>
<li>将zlib和libpng的源码目录添加到Visual C++的包含文件目录。形式如下:
<textarea readonly class="wiki">C:/Users/Joe/zlib
C:/Users/Joe/lpng1235
</textarea>
</li>
</ol>
<h2 id="a8.GetSpiderMonkeytheMozillaJavaScriptruntime">8. 获取 SpiderMonkey (Mozilla JavaScript 运行时环境)</h2>
<p>最简单的是从Mozilla下载预编译形式的代码XULRunner:<a class="ext-link" href="ftp://ftp.mozilla.org/pub/xulrunner/releases/"><span class="icon">ftp://ftp.mozilla.org/pub/xulrunner/releases/</span>
</a>
。</p>
<p>获取SDK版本,提取出来。将的lib目录添加到Visual C++的库文件目录列表。形式如下:</p>
<textarea readonly class="wiki">C:/Users/Joe/xulrunner-sdk/lib
</textarea><p>将的 <a class="missing wiki" rel="nofollow" href="https://sourceforge.net/apps/trac/openvrml/wiki/SpiderMonkey">SpiderMonkey?</a>
include目录添加到Visual C++的包含文件目录列表。形式如下:</p>
<textarea readonly class="wiki">C:/Users/Joe/xulrunner-sdk/include/js
</textarea><h2 id="a9.InstallSDL">9. 安装 SDL</h2>
<p>你有两个选择:下载预编译的DLL文件加上include文件,或者<a href="https://sourceforge.net/apps/trac/openvrml/wiki/BuildSdlForOpenvrml">自己来构建</a>
。预编译的可以去<a class="ext-link" href="http://www.libsdl.org/download-1.2.php"><span class="icon">http://www.libsdl.org/download-1.2.php</span>
</a>
下载。所包含的DLL文件将会被放到OpenVRML的二进制目录。</p>
<h2 id="a10.AddSDLsheaderandlibrarydirectoriestotheVCspathlists">10. 将SDL的头文件和库目录添加到VC++路径列表</h2>
<p>注:直接用DLL文件似乎不行,它调用的静态链接文件,需要下载源码编译为lib文件。</p>
<h2 id="a11.Runsdl-viewerinthedebugger">11. 在调试器中运行 sdl-viewer</h2>
<p>我们需要添加一个命令行参数来浏览文件,如为了测试可执行文件。右键单击sdl-viewer项目,点击属性,调试,命令参数。添加内容类似如下:</p>
<textarea readonly class="wiki">file:///c:/users/YOURNAME/desktop/openvrml/models/snoman.wrl
</textarea><h2 id="a12.Buildthesolution">12. 构建解决方案</h2>
<p>生成的唯一可执行文件为 sdl-viewer.exe。</p>
<h2 id="a13.Setenvironmentvariables">13. 设置环境变量</h2>
<p>将openvrml/data目录的完整路径设置到环境变量 OPENVRML_DATA。在Vista下形式如:</p>
<textarea readonly class="wiki">c:/users/YOURNAME/desktop/openvrml/data
</textarea><p>或在XP下:</p>
<textarea readonly class="wiki">c:/docume~1/YOURNAME/desktop/openvrml/data
</textarea><h2 id="a14.Setthesdl-viewerasthedefaultapplicationtodebug">14. 将sdl-viewer设置为缺省的应用程序来进行调试</h2>
<p>在sdl-viewer项目上右键单击,然后选择"设置为启动项目"</p>
<h2 id="a15.Runningscripts">15. 运行脚本</h2>
<p>如果你希望运行带有Javascript的VRML/X3D文件,你需要做两件事:首先,设置OPENVRML_SCRIPT_PATH 环境变量;然后,复制 JSAPI's js2350.dll 与 nspr4.dll 到OpenVRML的二进制目录。</p>
<h2 id="a16.PressF5toruntheprogramindebugmode">16. 按F5在调试模式下运行程序</h2>
<hr>
<h2 id="Troubleshooting">问题解决</h2>
<ul>
<li>If you get an error during the loading of DLLs, and the error code is hexadecimal, such as:
<textarea readonly class="wiki">The application failed to initialize property (0xE06D7363)
</textarea>
this may indicate that your <tt>OPENVRML_DATADIR</tt>
environment variable is unset or incorrectly set. In an ideal world, this problem would result in a <tt>MessageBox()</tt>
call; but presently it doesn't.</li>
</ul>
<ul>
<li>To do a proper "clean solution", you may not want to rely on VC++. It's not as deterministic as <tt>make</tt>
under Unix. Use Cygwin carefully thus:
<textarea readonly class="wiki">rm `find . -name "*.obj"`
rm `find . -name "*.lib"`
rm `find . -name "*.dll"`
rm `find . -name "*.exe"`
</textarea>
Don't forget the "-name" part! Forgetting it will remove everything.</li>
</ul>
<ul>
<li>If there is a problem with manifest files not being produced, note that VC++ normally produces them itself. To repair a manifest file problem, you may need to do a proper clean (above). It may help if you have <tt>/NODEFAULTLIB:MSVCRT.LIB</tt>
in your linker command-line arguments for all projects.</li>
</ul>
<p>下面贴出错误代码,有高手请指点一下:</p>
<p>1>正在链接...
<br>
1> 正在创建库 E:/X3D/Soft/openvrml-0.18.3/ide-projects/Windows/VisualC9_0</p>
<p>/OpenVRML/Release/lib/openvrml.lib 和对象 E:/X3D/Soft/openvrml-0.18.3/ide-</p>
<p>projects/Windows/VisualC9_0/OpenVRML/Release/lib/openvrml.exp
<br>
1>node_metatype_registry_impl.obj : error LNK2001: 无法解析的外部符号 "struct HINSTANCE__ *</p>
<p>__cdecl openvrml::local::dl::open(class std::basic_string<char,struct</p>
<p>std::char_traits<char>,class std::allocator<char> > const &)" (?</p>
<p>open@dl@local@openvrml@@YAPAUHINSTANCE__@@ABV?$basic_string@DU?$char_traits@D@std@@V?</p>
<p>$allocator@D@2@@std@@@Z)
<br>
1>node_metatype_registry_impl.obj : error LNK2001: 无法解析的外部符号 "void * __cdecl</p>
<p>openvrml::local::dl::sym(struct HINSTANCE__ *,class std::basic_string<char,struct</p>
<p>std::char_traits<char>,class std::allocator<char> > const &)" (?</p>
<p>sym@dl@local@openvrml@@YAPAXPAUHINSTANCE__@@ABV?$basic_string@DU?$char_traits@D@std@@V?</p>
<p>$allocator@D@2@@std@@@Z)
<br>
1>node_metatype_registry_impl.obj : error LNK2001: 无法解析的外部符号 "int __cdecl</p>
<p>openvrml::local::dl::foreachfile(class std::vector<class boost::filesystem::basic_path<class</p>
<p>std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct</p>
<p>boost::filesystem::path_traits>,class std::allocator<class</p>
<p>boost::filesystem::basic_path<class std::basic_string<char,struct</p>
<p>std::char_traits<char>,class std::allocator<char> >,struct boost::filesystem::path_traits> ></p>
<p>> const &,int (__cdecl*)(class std::basic_string<char,struct std::char_traits<char>,class</p>
<p>std::allocator<char> > const &,void *),void *)" (?foreachfile@dl@local@openvrml@@YAHABV?</p>
<p>$vector@V?$basic_path@V?$basic_string@DU?$char_traits@D@std@@V?</p>
<p>$allocator@D@2@@std@@Upath_traits@filesystem@boost@@@filesystem@boost@@V?$allocator@V?</p>
<p>$basic_path@V?$basic_string@DU?$char_traits@D@std@@V?</p>
<p>$allocator@D@2@@std@@Upath_traits@filesystem@boost@@@filesystem@boost@@@std@@@std@@P6AHABV?</p>
<p>$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@5@PAX@Z2@Z)
<br>
1>node_metatype_registry_impl.obj : error LNK2001: 无法解析的外部符号 "int __cdecl</p>
<p>openvrml::local::dl::close(struct HINSTANCE__ *)" (?</p>
<p>close@dl@local@openvrml@@YAHPAUHINSTANCE__@@@Z)
<br>
1>node_metatype_registry_impl.obj : error LNK2001: 无法解析的外部符号 "class</p>
<p>std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const</p>
<p>__cdecl openvrml::local::dl::error(void)" (?error@dl@local@openvrml@@YA?BV?</p>
<p>$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
<br>
1>node_metatype_registry_impl.obj : error LNK2001: 无法解析的外部符号 "int __cdecl</p>
<p>openvrml::local::dl::init(void)" (?init@dl@local@openvrml@@YAHXZ)
<br>
1>node_metatype_registry_impl.obj : error LNK2001: 无法解析的外部符号 "int __cdecl</p>
<p>openvrml::local::dl::exit(void)" (?exit@dl@local@openvrml@@YAHXZ)
<br>
1>E:/X3D/Soft/openvrml-0.18.3/ide-projects/Windows/VisualC9_0</p>
<p>/OpenVRML/Release/bin/openvrml.dll : fatal error LNK1120: 7 个无法解析的外部命令
<br>
1>生成日志保存在"file://e:/X3D/Soft/openvrml-0.18.3/ide-projects/Windows/VisualC9_0</p>
<p>/OpenVRML/openvrml/Release/BuildLog.htm"
<br>
1>openvrml - 8 个错误,2 个警告</p>
<p>14>LINK : fatal error LNK1104: 无法打开文件"LIBC.lib"
<br>
14>生成日志保存在"file://e:/X3D/Soft/openvrml-0.18.3/ide-projects/Windows/VisualC9_0</p>
<p>/OpenVRML/vrml97/Release/BuildLog.htm"
<br>
14>vrml97 - 1 个错误,1 个警告</p>
<p>19>正在链接...
<br>
19> 正在创建库 E:/X3D/Soft/openvrml-0.18.3/ide-projects/Windows/VisualC9_0</p>
<p>/OpenVRML/Release/bin/sdl-viewer.lib 和对象 E:/X3D/Soft/openvrml-0.18.3/ide-</p>
<p>projects/Windows/VisualC9_0/OpenVRML/Release/bin/sdl-viewer.exp
<br>
19>SDL.lib(SDL_systimer.obj) : error LNK2001: 无法解析的外部符号 __imp__timeGetTime@0
<br>
19>SDL.lib(SDL_systimer.obj) : error LNK2001: 无法解析的外部符号 __imp__timeBeginPeriod@4
<br>
19>SDL.lib(SDL_systimer.obj) : error LNK2001: 无法解析的外部符号 __imp__timeSetEvent@20
<br>
19>SDL.lib(SDL_systimer.obj) : error LNK2001: 无法解析的外部符号 __imp__timeEndPeriod@4
<br>
19>SDL.lib(SDL_systimer.obj) : error LNK2001: 无法解析的外部符号 __imp__timeKillEvent@4
<br>
19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 无法解析的外部符号 _GUID_POV
<br>
19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 无法解析的外部符号 _GUID_Slider
<br>
19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 无法解析的外部符号 _GUID_RzAxis
<br>
19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 无法解析的外部符号 _GUID_RyAxis
<br>
19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 无法解析的外部符号 _GUID_RxAxis
<br>
19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 无法解析的外部符号 _GUID_ZAxis
<br>
19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 无法解析的外部符号 _GUID_YAxis
<br>
19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 无法解析的外部符号 _GUID_XAxis
<br>
19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 无法解析的外部符号 _GUID_Key
<br>
19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 无法解析的外部符号 _IID_IDirectDrawSurface3
<br>
19>SDL.lib(SDL_dx5yuv.obj) : error LNK2001: 无法解析的外部符号 _IID_IDirectDrawSurface3
<br>
19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 无法解析的外部符号 _IID_IDirectDraw2
<br>
19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 无法解析的外部符号</p>
<p>_IID_IDirectDrawGammaControl
<br>
19>SDL.lib(SDL_syscdrom.obj) : error LNK2001: 无法解析的外部符号</p>
<p>__imp__mciGetErrorStringA@12
<br>
19>SDL.lib(SDL_syscdrom.obj) : error LNK2001: 无法解析的外部符号 __imp__mciSendCommandA@16
<br>
19>SDL.lib(SDL_mmjoystick.obj) : error LNK2001: 无法解析的外部符号 __imp__joyGetDevCapsA@12
<br>
19>SDL.lib(SDL_mmjoystick.obj) : error LNK2001: 无法解析的外部符号 __imp__joyGetPosEx@8
<br>
19>SDL.lib(SDL_mmjoystick.obj) : error LNK2001: 无法解析的外部符号 __imp__joyGetNumDevs@0
<br>
19>SDL.lib(SDL_dibaudio.obj) : error LNK2001: 无法解析的外部符号 __imp__waveOutWrite@12
<br>
19>SDL.lib(SDL_dibaudio.obj) : error LNK2001: 无法解析的外部符号</p>
<p>__imp__waveOutUnprepareHeader@12
<br>
19>SDL.lib(SDL_dibaudio.obj) : error LNK2001: 无法解析的外部符号 __imp__waveOutClose@4
<br>
19>SDL.lib(SDL_dibaudio.obj) : error LNK2001: 无法解析的外部符号</p>
<p>__imp__waveOutPrepareHeader@12
<br>
19>SDL.lib(SDL_dibaudio.obj) : error LNK2001: 无法解析的外部符号 __imp__waveOutOpen@24
<br>
19>SDL.lib(SDL_dibaudio.obj) : error LNK2001: 无法解析的外部符号</p>
<p>__imp__waveOutGetErrorTextA@12
<br>
19>SDL.lib(SDL_dx5events.obj) : error LNK2001: 无法解析的外部符号 _GUID_SysMouse
<br>
19>SDL.lib(SDL_dx5events.obj) : error LNK2001: 无法解析的外部符号 _GUID_SysKeyboard
<br>
19>SDL.lib(SDL_dx5events.obj) : error LNK2001: 无法解析的外部符号 _IID_IDirectInputDevice2A
<br>
19>E:/X3D/Soft/openvrml-0.18.3/ide-projects/Windows/VisualC9_0/OpenVRML/Release/bin/sdl-</p>
<p>viewer.exe : fatal error LNK1120: 31 个无法解析的外部命令
<br>
19>生成日志保存在"file://e:/X3D/Soft/openvrml-0.18.3/ide-projects/Windows/VisualC9_0</p>
<p>/OpenVRML/sdl-viewer/Release/BuildLog.htm"
<br>
19>sdl-viewer - 33 个错误,0 个警告</p>
<p class="poweredbyzoundry">Powered by <span class="poweredbyzoundry_link">Zoundry Raven</span>
</p>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值