天天看點

怎樣在Windows下編譯OpenVRML

Original version copyright (C) Zack Smith 2008

今天花了一整天的時候配置編譯環境并編譯,盡管仍未編譯成功,但已将錯誤減少至兩處,而且這剩下的兩處也應該是我對VC不了解而出現的,希望能很快解決。 注:build在文中被譯作建構,可能有點别扭。。。

至少要為最新版本的Microsoft Visual C++ 編譯器(目前為9.0)安裝"Multithread" 和 "Multithread Debug"變體的庫。注:這個工具可以根據需要下載下傳源檔案和預編譯的庫檔案,根據後面編譯的情況來看,應該還要選date_time、system、thread等。

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.

Visual C++ 9.0 的解決方案檔案可以在OpenVRML的如下目錄找到

OpenVRML 依賴于很多庫 - 每一個都要單獨下載下傳,并且必須要将它們的include和library目錄添加到Visual C++路徑清單中。下面的步驟闡明了如何添加到路徑清單。

選擇工具 -> 選項下拉菜單

在"項目和解決方案"中,選擇"VC++目錄",然後"包含檔案"

點選檔案夾圖示,添加帶版本号的boost目錄到路徑中。它應該類似于這樣:

怎樣在Windows下編譯OpenVRML

現在再選擇"庫檔案"

怎樣在Windows下編譯OpenVRML

點選檔案夾圖示添加路徑,看起來應該像這樣:

在Visual C++中打開解決方案檔案。可以在FreeType的builds/win32/vc2008 目錄下找到。

選擇freetype項目中的"LIB Release Multithreaded" 與 "LIB Debug Multithreaded"配置進行建構。

FreeType解決方案會輸出所有的庫到同樣的目錄下,objs/win32/vc2008 .(提一下,個别的路徑可能根據所用的編譯版本而有所不同) 。将該目錄添加到VS的庫目錄下。形式如下:

将FreeType的include子目錄添加到VS的包含檔案目錄。形式如下:

解壓libpng後,将zlib的内容解壓到與libpng同一級目錄下的"zlib"檔案夾。利潤,如果你的libpng放在C:/Users/Joe/lpng1235 ,你的zlib就應該放在C:/Users/Joe/zlib 。注意盡管libpng的zip檔案包含了頂級目錄,但zlib到目前1.2.3版本為止未包括。

在Visual C++中打開libpng解決方案檔案。可以在libpng的projects/visualc71/libpng.sln 找到。

按照 libpng 項目的"LIB Debug" 和 "LIB Release"配置進行建構。zlib會自動作為依賴被建構。

将libpng的輸出目錄添加到Visual C++的庫目錄清單。形式如下:

将zlib和libpng的源碼目錄添加到Visual C++的包含檔案目錄。形式如下:

擷取SDK版本,提取出來。将的lib目錄添加到Visual C++的庫檔案目錄清單。形式如下:

注:直接用DLL檔案似乎不行,它調用的靜态連結檔案,需要下載下傳源碼編譯為lib檔案。

我們需要添加一個指令行參數來浏覽檔案,如為了測試可執行檔案。右鍵單擊sdl-viewer項目,點選屬性,調試,指令參數。添加内容類似如下:

生成的唯一可執行檔案為 sdl-viewer.exe。

将openvrml/data目錄的完整路徑設定到環境變量 OPENVRML_DATA。在Vista下形式如:

或在XP下:

在sdl-viewer項目上右鍵單擊,然後選擇"設定為啟動項目"

如果你希望運作帶有Javascript的VRML/X3D檔案,你需要做兩件事:首先,設定OPENVRML_SCRIPT_PATH 環境變量;然後,複制 JSAPI's js2350.dll 與 nspr4.dll 到OpenVRML的二進制目錄。

If you get an error during the loading of DLLs, and the error code is hexadecimal, such as:

this may indicate that your OPENVRML_DATADIR environment variable is unset or incorrectly set. In an ideal world, this problem would result in a MessageBox() call; but presently it doesn't.

To do a proper "clean solution", you may not want to rely on VC++. It's not as deterministic as make under Unix. Use Cygwin carefully thus:

Don't forget the "-name" part! Forgetting it will remove everything.

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 /NODEFAULTLIB:MSVCRT.LIB in your linker command-line arguments for all projects.

下面貼出錯誤代碼,有高手請指點一下:

1>正在連結...

1> 正在建立庫 E:/X3D/Soft/openvrml-0.18.3/ide-projects/Windows/VisualC9_0

/OpenVRML/Release/lib/openvrml.lib 和對象 E:/X3D/Soft/openvrml-0.18.3/ide-

projects/Windows/VisualC9_0/OpenVRML/Release/lib/openvrml.exp

1>node_metatype_registry_impl.obj : error LNK2001: 無法解析的外部符号 "struct HINSTANCE__ *

__cdecl openvrml::local::dl::open(class std::basic_string<char,struct

std::char_traits<char>,class std::allocator<char> > const &)" (?

open@dl@local@openvrml@@YAPAUHINSTANCE__@@ABV?$basic_string@DU?$char_traits@D@std@@V?

$allocator@D@2@@std@@@Z)

1>node_metatype_registry_impl.obj : error LNK2001: 無法解析的外部符号 "void * __cdecl

openvrml::local::dl::sym(struct HINSTANCE__ *,class std::basic_string<char,struct

sym@dl@local@openvrml@@YAPAXPAUHINSTANCE__@@ABV?$basic_string@DU?$char_traits@D@std@@V?

1>node_metatype_registry_impl.obj : error LNK2001: 無法解析的外部符号 "int __cdecl

openvrml::local::dl::foreachfile(class std::vector<class boost::filesystem::basic_path<class

std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct

boost::filesystem::path_traits>,class std::allocator<class

boost::filesystem::basic_path<class std::basic_string<char,struct

std::char_traits<char>,class std::allocator<char> >,struct boost::filesystem::path_traits> >

> const &,int (__cdecl*)(class std::basic_string<char,struct std::char_traits<char>,class

std::allocator<char> > const &,void *),void *)" (?foreachfile@dl@local@openvrml@@YAHABV?

$vector@V?$basic_path@V?$basic_string@DU?$char_traits@D@std@@V?

$allocator@D@2@@std@@Upath_traits@filesystem@boost@@@filesystem@boost@@V?$allocator@V?

$basic_path@V?$basic_string@DU?$char_traits@D@std@@V?

$allocator@D@2@@std@@Upath_traits@filesystem@boost@@@filesystem@boost@@@std@@@std@@P6AHABV?

$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@5@PAX@Z2@Z)

openvrml::local::dl::close(struct HINSTANCE__ *)" (?

close@dl@local@openvrml@@YAHPAUHINSTANCE__@@@Z)

1>node_metatype_registry_impl.obj : error LNK2001: 無法解析的外部符号 "class

std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const

__cdecl openvrml::local::dl::error(void)" (?error@dl@local@openvrml@@YA?BV?

$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)

openvrml::local::dl::init(void)" (?init@dl@local@openvrml@@YAHXZ)

openvrml::local::dl::exit(void)" (?exit@dl@local@openvrml@@YAHXZ)

1>E:/X3D/Soft/openvrml-0.18.3/ide-projects/Windows/VisualC9_0

/OpenVRML/Release/bin/openvrml.dll : fatal error LNK1120: 7 個無法解析的外部指令

1>生成日志儲存在"file://e:/X3D/Soft/openvrml-0.18.3/ide-projects/Windows/VisualC9_0

/OpenVRML/openvrml/Release/BuildLog.htm"

1>openvrml - 8 個錯誤,2 個警告

14>LINK : fatal error LNK1104: 無法打開檔案"LIBC.lib"

14>生成日志儲存在"file://e:/X3D/Soft/openvrml-0.18.3/ide-projects/Windows/VisualC9_0

/OpenVRML/vrml97/Release/BuildLog.htm"

14>vrml97 - 1 個錯誤,1 個警告

19>正在連結...

19> 正在建立庫 E:/X3D/Soft/openvrml-0.18.3/ide-projects/Windows/VisualC9_0

/OpenVRML/Release/bin/sdl-viewer.lib 和對象 E:/X3D/Soft/openvrml-0.18.3/ide-

projects/Windows/VisualC9_0/OpenVRML/Release/bin/sdl-viewer.exp

19>SDL.lib(SDL_systimer.obj) : error LNK2001: 無法解析的外部符号 __imp__timeGetTime@0

19>SDL.lib(SDL_systimer.obj) : error LNK2001: 無法解析的外部符号 __imp__timeBeginPeriod@4

19>SDL.lib(SDL_systimer.obj) : error LNK2001: 無法解析的外部符号 __imp__timeSetEvent@20

19>SDL.lib(SDL_systimer.obj) : error LNK2001: 無法解析的外部符号 __imp__timeEndPeriod@4

19>SDL.lib(SDL_systimer.obj) : error LNK2001: 無法解析的外部符号 __imp__timeKillEvent@4

19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 無法解析的外部符号 _GUID_POV

19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 無法解析的外部符号 _GUID_Slider

19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 無法解析的外部符号 _GUID_RzAxis

19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 無法解析的外部符号 _GUID_RyAxis

19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 無法解析的外部符号 _GUID_RxAxis

19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 無法解析的外部符号 _GUID_ZAxis

19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 無法解析的外部符号 _GUID_YAxis

19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 無法解析的外部符号 _GUID_XAxis

19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 無法解析的外部符号 _GUID_Key

19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 無法解析的外部符号 _IID_IDirectDrawSurface3

19>SDL.lib(SDL_dx5yuv.obj) : error LNK2001: 無法解析的外部符号 _IID_IDirectDrawSurface3

19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 無法解析的外部符号 _IID_IDirectDraw2

19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 無法解析的外部符号

_IID_IDirectDrawGammaControl

19>SDL.lib(SDL_syscdrom.obj) : error LNK2001: 無法解析的外部符号

__imp__mciGetErrorStringA@12

19>SDL.lib(SDL_syscdrom.obj) : error LNK2001: 無法解析的外部符号 __imp__mciSendCommandA@16

19>SDL.lib(SDL_mmjoystick.obj) : error LNK2001: 無法解析的外部符号 __imp__joyGetDevCapsA@12

19>SDL.lib(SDL_mmjoystick.obj) : error LNK2001: 無法解析的外部符号 __imp__joyGetPosEx@8

19>SDL.lib(SDL_mmjoystick.obj) : error LNK2001: 無法解析的外部符号 __imp__joyGetNumDevs@0

19>SDL.lib(SDL_dibaudio.obj) : error LNK2001: 無法解析的外部符号 __imp__waveOutWrite@12

19>SDL.lib(SDL_dibaudio.obj) : error LNK2001: 無法解析的外部符号

__imp__waveOutUnprepareHeader@12

19>SDL.lib(SDL_dibaudio.obj) : error LNK2001: 無法解析的外部符号 __imp__waveOutClose@4

__imp__waveOutPrepareHeader@12

19>SDL.lib(SDL_dibaudio.obj) : error LNK2001: 無法解析的外部符号 __imp__waveOutOpen@24

__imp__waveOutGetErrorTextA@12

19>SDL.lib(SDL_dx5events.obj) : error LNK2001: 無法解析的外部符号 _GUID_SysMouse

19>SDL.lib(SDL_dx5events.obj) : error LNK2001: 無法解析的外部符号 _GUID_SysKeyboard

19>SDL.lib(SDL_dx5events.obj) : error LNK2001: 無法解析的外部符号 _IID_IDirectInputDevice2A

19>E:/X3D/Soft/openvrml-0.18.3/ide-projects/Windows/VisualC9_0/OpenVRML/Release/bin/sdl-

viewer.exe : fatal error LNK1120: 31 個無法解析的外部指令

19>生成日志儲存在"file://e:/X3D/Soft/openvrml-0.18.3/ide-projects/Windows/VisualC9_0

/OpenVRML/sdl-viewer/Release/BuildLog.htm"

19>sdl-viewer - 33 個錯誤,0 個警告

Powered by Zoundry Raven

繼續閱讀