为 Windows Embedded Compact 7 编译 boost 库
Posted
技术标签:
【中文标题】为 Windows Embedded Compact 7 编译 boost 库【英文标题】:Compiling boost library for Windows Embedded Compact 7 【发布时间】:2011-12-07 10:29:42 【问题描述】:我正在为带有运行 Windows Embedded Compact 7 的 NVIDIA Tegra 2 的嵌入式设备编程。我的开发环境是 Microsoft Visual Studio 2008。boost 库,尤其是 boost-asio 包似乎对我的需求很有帮助。不幸的是,我无法找到关于如何在 Windows Embedded Compact 7 上运行 boost 的良好指南。我希望获得可以静态链接到我的应用程序的 .lib
文件。
【问题讨论】:
【参考方案1】:关于此过程的文档似乎很少,因为它需要对构建过程进行重大更新才能使用 Windows CE。这个问题最全面的教程似乎是here。
由于您明确标记了此boost-asio
,因此我还专门研究了 Boost 的该组件。 Here's a thread from the Boost mailing list 详细介绍了这个库,包括您可能遇到的潜在故障情况,JAM file modifications, 和 a batch file to help you with the build。*
对于阅读本文的人:请在您完成此操作后分享您的经验。尽管有各种担忧,Boost is too memory-heavy for embedded applications,Boost 提供了使用单独的包来满足您的需求的能力。我希望 SO 上的其他用户非常对你的体验感兴趣。
* 因为人们一直在表达当 Nabble 链接到期时引用的批处理文件消失的问题,所以这里有一个粘贴转储供后人使用:
@SET VCINSTALLDIR=%VS9INSTALLDIR%\VC
@if "%VS9INSTALLDIR%"=="" goto error_no_VSINSTALLDIR
@if "%VCINSTALLDIR%"=="" goto error_no_VCINSTALLDIR
@echo Setting environment for using Microsoft Visual Studio 2008 tools for WM5.
@set TARGETCPU=X86
@call :GetWindowsSdkDir
@if not "%WindowsSdkDir%" == "" (
set "PATH=%WindowsSdkDir%bin;%PATH%"
)
@rem
@rem Root of Visual Studio IDE installed files.
@rem
@set DevEnvDir=%VS9INSTALLDIR%\Common7\IDE
@set PATH=%VCINSTALLDIR%\CE\bin\x86_arm;%VCINSTALLDIR%\bin;%VS9INSTALLDIR%\Common7\Tools;%DevEnvDir%;%VS9INSTALLDIR%\Common\Tools;%VS9INSTALLDIR%\Common\IDE;%VS9INSTALLDIR%;%PATH%
@set INCLUDE=%STLPORT_PATH%\STLPort-5.2.1\stlport;%VCINSTALLDIR%\ce\include;%CETOOLS%\Windows Mobile 5.0 Pocket PC SDK\include\ARMV4I;%CETOOLS%\Windows Mobile 5.0 Pocket PC SDK\include;%VCINSTALLDIR%\ce\atlmfc\include
@set LIB=%STLPORT_PATH%\STLPort-5.2.1\lib\evc9-arm;%CETOOLS%\Windows Mobile 5.0 Pocket PC SDK\lib\ARMV4I;%VCINSTALLDIR%\ce\ATLMFC\LIB\ARMV4I;%VCINSTALLDIR%\ce\LIB\ARMV4I
@set LIBPATH=
@goto end
:GetWindowsSdkDir
@call :GetWindowsSdkDirHelper HKLM > nul 2>&1
@if errorlevel 1 call :GetWindowsSdkDirHelper HKCU > nul 2>&1
@if errorlevel 1 set WindowsSdkDir=%VCINSTALLDIR%\PlatformSDK\
@exit /B 0
:GetWindowsSdkDirHelper
@for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\Microsoft SDKs\Windows" /v "CurrentInstallFolder"') DO (
if "%%i"=="CurrentInstallFolder" (
SET "WindowsSdkDir=%%k"
)
)
@if "%WindowsSdkDir%"=="" exit /B 1
@exit /B 0
:error_no_VSINSTALLDIR
@echo ERROR: VS9INSTALLDIR variable is not set.
@goto end
:error_no_VCINSTALLDIR
@echo ERROR: VCINSTALLDIR variable is not set.
@goto end
:end
@SET VCINSTALLDIR=%VS9INSTALLDIR%\VC
@SET FrameworkDir=C:\WINDOWS\Microsoft.NET\Framework
@SET FrameworkVersion=v2.0.50727
@SET Framework35Version=v3.5
@if "%VS9INSTALLDIR%"=="" goto error_no_VSINSTALLDIR
@if "%VCINSTALLDIR%"=="" goto error_no_VCINSTALLDIR
@echo Setting environment for using Microsoft Visual Studio 2008 x86 tools with STLport-5.2.1.
@call :GetWindowsSdkDir
@if not "%WindowsSdkDir%" == "" (
set "PATH=%WindowsSdkDir%bin;%PATH%"
set "INCLUDE=%WindowsSdkDir%include;%INCLUDE%"
set "LIB=%WindowsSdkDir%lib;%LIB%"
)
@rem
@rem Root of Visual Studio IDE installed files.
@rem
@set DevEnvDir=%VS9INSTALLDIR%\Common7\IDE
@set PATH=%DevEnvDir%;%VCINSTALLDIR%\BIN;%VS9INSTALLDIR%\Common7\Tools;%FrameworkDir%\%Framework35Version%;%FrameworkDir%\%FrameworkVersion%;%VCINSTALLDIR%\VCPackages;%PATH%
@set INCLUDE=%STLPORT_PATH%\STLport-5.2.1\stlport;%VCINSTALLDIR%\ATLMFC\INCLUDE;%VCINSTALLDIR%\INCLUDE;%INCLUDE%
@set LIB=%STLPORT_PATH%\STLport-5.2.1\lib\vc9;%VCINSTALLDIR%\ATLMFC\LIB;%VCINSTALLDIR%\LIB;%LIB%
@set LIBPATH=%FrameworkDir%\%Framework35Version%;%FrameworkDir%\%FrameworkVersion%;%VCINSTALLDIR%\ATLMFC\LIB;%VCINSTALLDIR%\LIB;%LIBPATH%
@goto end
:GetWindowsSdkDir
@call :GetWindowsSdkDirHelper HKLM > nul 2>&1
@if errorlevel 1 call :GetWindowsSdkDirHelper HKCU > nul 2>&1
@if errorlevel 1 set WindowsSdkDir=%VCINSTALLDIR%\PlatformSDK\
@exit /B 0
:GetWindowsSdkDirHelper
@for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\Microsoft SDKs\Windows" /v "CurrentInstallFolder"') DO (
if "%%i"=="CurrentInstallFolder" (
SET "WindowsSdkDir=%%k"
)
)
@if "%WindowsSdkDir%"=="" exit /B 1
@exit /B 0
:error_no_VSINSTALLDIR
@echo ERROR: VSINSTALLDIR variable is not set.
@goto end
:error_no_VCINSTALLDIR
@echo ERROR: VCINSTALLDIR variable is not set.
@goto end
:end
【讨论】:
以上是关于为 Windows Embedded Compact 7 编译 boost 库的主要内容,如果未能解决你的问题,请参考以下文章
Windows Mobile 6.5 与 Windows Embedded Handheld 6.5 - 有啥区别?