present3D是什么
这个在google上很容易找到,这里就不翻译了。
如何获取present3D
svn,或是二进制present3D当然OSG里面也有...但是好像功能不全.
我编译present3D使用的库
present3D svn trunk上的源代码,
sdl1.2.5
libxml 2.8.9 win32
iconv 1.9.0
最后不要忘记在编译器的release和debug模式中添加Ws2_32.h
开始编译
如果不了解开源库的编译,参看我的另一篇文章
(1)使用CMake
(2)Visual Studio,bach build。。。。
请始终记住,缺什么,给什么。
我再编译过程中遇到了一些严重问题:
当我在Visual Studio上编译时,刚开始报错error c1083: encoding.h无法找到iconv.h,路径错误
后来我会到present3D给我的下载网站上继续看。。。发现我少下载了一个依赖。就是iconv,我把它下载下来配置好路径,编译。
第二个错误,
Time Elapsed 00:00:00.07
------ Build started: Project: Applications present3D, Configuration: Release Win32 ------
Build started 2012/4/15 6:56:08.
InitializeBuildStatus:
Touching "application_present3D.dir\Release\Applications present3D.unsuccessfulbuild".
CustomBuild:
All outputs are up-to-date.
ClCompile:
All outputs are up-to-date.
Cluster.obj : error LNK2019: unresolved external symbol _closesocket@4 referenced in function "public: __thiscall Receiver::~Receiver(void)" (??1Receiver@@QAE@XZ)
Cluster.obj : error LNK2019: unresolved external symbol _bind@12 referenced in function "private: bool __thiscall Receiver::init(void)" (?init@Receiver@@AAE_NXZ)
Cluster.obj : error LNK2019: unresolved external symbol _htonl@4 referenced in function "private: bool __thiscall Receiver::init(void)" (?init@Receiver@@AAE_NXZ)
Cluster.obj : error LNK2019: unresolved external symbol _htons@4 referenced in function "private: bool __thiscall Receiver::init(void)" (?init@Receiver@@AAE_NXZ)
Cluster.obj : error LNK2019: unresolved external symbol _socket@12 referenced in function "private: bool __thiscall Receiver::init(void)" (?init@Receiver@@AAE_NXZ)
Cluster.obj : error LNK2019: unresolved external symbol _WSAStartup@8 referenced in function "private: bool __thiscall Receiver::init(void)" (?init@Receiver@@AAE_NXZ)
Cluster.obj : error LNK2019: unresolved external symbol ___WSAFDIsSet@8 referenced in function "public: void __thiscall Receiver::sync(void)" (?sync@Receiver@@QAEXXZ)
Cluster.obj : error LNK2019: unresolved external symbol _select@20 referenced in function "public: void __thiscall Receiver::sync(void)" (?sync@Receiver@@QAEXXZ)
Cluster.obj : error LNK2019: unresolved external symbol _WSAGetLastError@0 referenced in function "public: void __thiscall Receiver::sync(void)" (?sync@Receiver@@QAEXXZ)
Cluster.obj : error LNK2019: unresolved external symbol _recvfrom@24 referenced in function "public: void __thiscall Receiver::sync(void)" (?sync@Receiver@@QAEXXZ)
Cluster.obj : error LNK2019: unresolved external symbol _setsockopt@20 referenced in function "private: bool __thiscall Broadcaster::init(void)" (?init@Broadcaster@@AAE_NXZ)
Cluster.obj : error LNK2019: unresolved external symbol _gethostbyname@4 referenced in function "public: void __thiscall Broadcaster::setHost(char const *)" (?setHost@Broadcaster@@QAEXPBD@Z)
Cluster.obj : error LNK2019: unresolved external symbol _sendto@24 referenced in function "public: void __thiscall Broadcaster::sync(void)" (?sync@Broadcaster@@QAEXXZ)
D:\Present3D\build\bin\Release\present3D.exe : fatal error LNK1120: 13 unresolved externals
Build FAILED.
Time Elapsed 00:00:00.28
------ Build started: Project: Applications present3D, Configuration: Debug Win32 ------
Build started 2012/4/15 6:56:09.
InitializeBuildStatus:
Creating "application_present3D.dir\Debug\Applications present3D.unsuccessfulbuild" because "AlwaysCreate" was specified.
CustomBuild:
All outputs are up-to-date.
ClCompile:
All outputs are up-to-date.
ManifestResourceCompile:
All outputs are up-to-date.
Link:
All outputs are up-to-date.
Manifest:
All outputs are up-to-date.
FinalizeBuildStatus:
Deleting file "application_present3D.dir\Debug\Applications present3D.unsuccessfulbuild".
Touching "application_present3D.dir\Debug\Applications present3D.lastbuildstate".
Build succeeded.
Time Elapsed 00:00:00.20
------ Build started: Project: ALL_BUILD, Configuration: Release Win32 ------
Build started 2012/4/15 6:56:09.
InitializeBuildStatus:
Creating "Win32\Release\ALL_BUILD\ALL_BUILD.unsuccessfulbuild" because "AlwaysCreate" was specified.
CustomBuild:
Build all projects
FinalizeBuildStatus:
Deleting file "Win32\Release\ALL_BUILD\ALL_BUILD.unsuccessfulbuild".
Touching "Win32\Release\ALL_BUILD\ALL_BUILD.lastbuildstate".
Build succeeded.
Time Elapsed 00:00:00.09
------ Build started: Project: ALL_BUILD, Configuration: Debug Win32 ------
Build started 2012/4/15 6:56:09.
InitializeBuildStatus:
Creating "Win32\Debug\ALL_BUILD\ALL_BUILD.unsuccessfulbuild" because "AlwaysCreate" was specified.
CustomBuild:
Build all projects
FinalizeBuildStatus:
Deleting file "Win32\Debug\ALL_BUILD\ALL_BUILD.unsuccessfulbuild".
Touching "Win32\Debug\ALL_BUILD\ALL_BUILD.lastbuildstate".
Build succeeded.
Time Elapsed 00:00:00.06
------ Build started: Project: INSTALL, Configuration: Release Win32 ------
Build started 2012/4/15 6:56:09.
InitializeBuildStatus:
Creating "Win32\Release\INSTALL\INSTALL.unsuccessfulbuild" because "AlwaysCreate" was specified.
PostBuildEvent:
-- Install configuration: "Release"
CMake Error at src/cmake_install.cmake:34 (FILE):
file INSTALL cannot find "D:/Present3D/build/bin/Release/present3D.exe".
Call Stack (most recent call first):
cmake_install.cmake:32 (INCLUDE)
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: The command "setlocal
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: "C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -DBUILD_TYPE=Release -P cmake_install.cmake
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :cmEnd
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :cmErrorLevel
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: exit /b %1
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :cmDone
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :VCEnd" exited with code 1通过搜索发现,其实closesocket是windows的Ws2_32.h中的一个函数(具体请参考msdn中closesocket),由于某种原因,在CMake中没有将包含该函数的lib库文件被包含进来,我们只要添加这个lib文件就可以了。
通过这次学习,我终于发现了,lnk2019报错的显示方式是:先提示外部符号是什么,最后再提示用户这个符号在那个函数中被引用。