c++ - 编译 Liblas

标签 c++ visual-studio-2010 boost cmake liblas

我正在尝试安装库 libLAS。我正在使用 Microsoft Visual Studio 2010、windows 7 和 Cmake 2.8.10.2。到目前为止,我已经安装了 Boost 1.51 并且遵循了本教程: http://www.liblas.org/compilation.html#using-visual-studio-9-2008-on-windows

在 cmake 出现不少问题后,我创建了 .sln,我现在正在尝试编译它。特别是,我正在尝试构建项目“liblas”。 我收到 37 个错误,都像这样:

Error   1   error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)  C:\temp\libLAS\buildout\src\writer.cpp.obj

编辑添加其他错误:

2>     Creating library C:/temp/libLAS/buildout/bin/Release/liblas.lib and object C:/temp/libLAS/buildout/bin/Release/liblas.exp
2>writer.cpp.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)
2>header.cpp.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)
2>reader.cpp.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)
2>header.cpp.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)
2>point.cpp.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)
2>point.cpp.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)
2>reader.cpp.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)
2>utility.cpp.obj : error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ) referenced in function "public: __cdecl std::basic_ostringstream<char,struct std::char_traits<char>,class std::allocator<char> >::basic_ostringstream<char,struct std::char_traits<char>,class std::allocator<char> >(int)" (??0?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@H@Z)
2>writer.cpp.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)
2>index.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)
2>transform.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)
2>cachedreader.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)
2>header.cpp.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)
2>indexoutput.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)
2>chipper.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)
2>factory.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)
2>filter.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)
2>writer.cpp.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ)
2>libboost_thread-vc100-mt-1_51.lib(thread.obj) : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ)
2>header.cpp.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ)
2>reader.cpp.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ)
2>header.cpp.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ)
2>point.cpp.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ)
2>point.cpp.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ)
2>reader.cpp.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ)
2>utility.cpp.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ)
2>writer.cpp.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ)
2>index.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ)
2>transform.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ)
2>cachedreader.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ)
2>header.cpp.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ)
2>indexoutput.obj : error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'native_ecat''(void)" (??__Enative_ecat@system@boost@@YAXXZ)
2>chipper.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ)
2>factory.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ)
2>filter.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ)
2>libboost_thread-vc100-mt-1_51.lib(thread.obj) : error LNK2019: unresolved external symbol "public: static class boost::chrono::time_point<class boost::chrono::system_clock,class boost::chrono::duration<__int64,class boost::ratio<1,10000000> > > __cdecl boost::chrono::system_clock::now(void)" (?now@system_clock@chrono@boost@@SA?AV?$time_point@Vsystem_clock@chrono@boost@@V?$duration@_JV?$ratio@$00$0JIJGIA@@boost@@@23@@23@XZ) referenced in function "public: bool __cdecl boost::thread::try_join_until(class boost::chrono::time_point<class boost::chrono::system_clock,class boost::chrono::duration<__int64,class boost::ratio<1,1000000000> > > const &)" (?try_join_until@thread@boost@@QEAA_NAEBV?$time_point@Vsystem_clock@chrono@boost@@V?$duration@_JV?$ratio@$00$0DLJKMKAA@@boost@@@23@@chrono@2@@Z)
2>C:\temp\libLAS\buildout\bin\Release\liblas.dll : fatal error LNK1120: 3 unresolved externals
2>
2>Build FAILED.

最佳答案

BlueGo 可以为您构建 libLAS: https://bitbucket.org/Vertexwahn/bluego

您可以通过以下方式使用 VS2017 在 Windows 上构建它:

set dest=C:\thirdparty\vs2017\x64
set cmake_command=cmake
set boost_root=C:/thirdparty/vs2017/x64/boost_1_65_0
if NOT [%1]==[] set dest=%~1
if NOT [%2]==[] set cmake_command="%~2"
if NOT [%3]==[] set boost_root=%~3
if [%1]==["--boost-root"] set boost_root=%~2
wget.exe --no-check-certificate https://github.com/libLAS/libLAS-1.6/archive/master.zip -O%cd%\master.zip
7za.exe x %cd%\master.zip -o%dest%
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
%cmake_command% -DBUILD_STATIC_LIBS=ON -DBOOST_ROOT=%boost_root% -G"Visual Studio 15 2017 Win64" -H%dest%\libLAS-1.6-master -B%dest%\libLAS-1.6-master\build
del %cd%\master.zip
C:
cd %dest%\libLAS-1.6-master\build
%cmake_command% --build . --config Debug --target liblas
%cmake_command% --build . --config Release --target liblas
%cmake_command% --build . --config RelWithDebInfo --target liblas
%cmake_command% --build . --config Debug --target liblas_c
%cmake_command% --build . --config Release --target liblas_c
%cmake_command% --build . --config RelWithDebInfo --target liblas_c

关于c++ - 编译 Liblas,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15479025/

相关文章:

c++ - 从 boost::fusion::tuple 访问第 0 个元素

c++ - std::array 的大小是否由标准定义

c++ - 如何键入用于 const 对象的自定义 io 操纵器?

c++ - 使用 cmake 和 visual studio 的一个解决方案中的多个项目

c++ - (如何)我可以在不安装完整的 boost 库的情况下使用 boost::spirit X3 吗?

c++ - boost::managed_mapped_file 无法分配所有增长的空间

c++ - 检查点是否在 vector 内

C# --> 转到定义 ==> VB.NET

c++ - Visual Studio 2010 Win32 应用程序无法在 Windows XP 上启动

c++ - 段错误 : 11 while using boost mutex