在WDK使用boost构建应用程序的环境呢? [英] Using boost in WDK build environment for applications?

查看:323
本文介绍了在WDK使用boost构建应用程序的环境呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Windows驱动程序工具包(WINDDK 6001.18001)来构建,而不是Visual Studio 2005中,我采取这种方法我的用户空间的应用程序,因为我们还必须建立驱动程序组件,所以我倒是preFER有单一的编译环境建立的一切。微软本身使用了这种方法的几个产品。

这是工作的罚款,直到我开始使用升压1.38.0。我没有使用C ++内核模式组件,只需用户空间应用。在C ++中code,是很自然的使用升压库。不幸的是,WDK不同意。

我注意到的第一个错误是,#包括LT&;&cstddef GT;不把 ptrdiff_t的在std命名空间,因为似乎需要附件D.解决此左边几个错误在工作升压\\的lambda \\详细\\ operator_return_type_traits .HPP 关于错误C2976:'的std :: basic_string的':太少的模板参数这似乎多余的iostream的。

有没有人成功地得到了增强,iostream的组合,和WDK一起工作?

我的消息来源文件:

  TARGETNAME = foobar的
TARGETTYPE = PROGRAMUSE_MSVCRT = 1
USE_STL = 1
USE_ATL = 1
ATL_VER = 30
STL_VER = 70
USE_NATIVE_EH = 1
USE_IOSTREAM = 1SUBSYSTEM_VERSION = 5.02C_DEFINES = \\
    -D_MT \\
    -DWIN_32 \\
    -DWIN32 \\
    -D_WINDOWS \\
    -DNT \\
    -D_WIN32_DCOM \\
    -DUNI code \\
    -D_UNI code \\
    -D_ATL_NO_DEBUG_CRT#因为我们使用USE_MSVCRT = 1来源= service.cppINCLUDES = \\
    $(BOOST_INC_PATH)TARGETLIBS = \\
    $(SDK_LIB_PATH)\\ ole32.lib \\
    $(SDK_LIB_PATH)\\ oleaut32.lib \\
    $(SDK_LIB_PATH)\\ UUID.LIB \\UMTYPE =控制台
UMBASE =为0x400000

service.cpp:

 的#include<&iostream的GT;
#包括LT&;&cstddef GT;空间std {
        的typedef :: ptrdiff_t的ptrdiff_t的; // DDK C ++的解决方法
}#包括LT&;升压/λ/ lambda.hpp>INT __cdecl的main(){
    返回0;
}


解决方案

升压可能已经包含一个变通为你的问题,但并不适用,因为它不承认你使用的编译器(可能是因为司机很少使用boost)。

尝试检查(也可能编辑)升压/配置/ select_compiler_config.hpp 升压/配置/编译器/ visualc.hpp ,以确保为MSVC编译器的解决方法已启用。

I am using the Windows Driver Kit (WinDDK 6001.18001) to build my userspace application rather than Visual Studio 2005. I am taking this approach because we also have to build driver components, so I'd prefer to have a single build environment to build everything. Microsoft itself uses this approach for several products.

This was working fine until I started using Boost 1.38.0. I'm not using C++ in the kernel mode components, just the userspace applications. In C++ code, it's natural to use the boost libraries. Unfortunately, the WDK doesn't agree.

The first error I noticed is that "#include <cstddef>" doesn't put ptrdiff_t in the std namespace, as seems required by Annex D. Working around this left several errors in boost\lambda\detail\operator_return_type_traits.hpp about error C2976: 'std::basic_string' : too few template arguments. It appears redundant with iostream.

Has anyone successfully gotten the combination of Boost, iostream, and the WDK to work together?

My sources file:

TARGETNAME=foobar
TARGETTYPE=PROGRAM

USE_MSVCRT = 1
USE_STL = 1
USE_ATL = 1
ATL_VER = 30
STL_VER = 70
USE_NATIVE_EH = 1 
USE_IOSTREAM = 1

SUBSYSTEM_VERSION = 5.02

C_DEFINES = \
    -D_MT \
    -DWIN_32 \
    -DWIN32  \
    -D_WINDOWS \
    -DNT \
    -D_WIN32_DCOM \
    -DUNICODE \
    -D_UNICODE \
    -D_ATL_NO_DEBUG_CRT # because we are using USE_MSVCRT=1 

SOURCES=service.cpp

INCLUDES=\
    $(BOOST_INC_PATH)

TARGETLIBS=\
    $(SDK_LIB_PATH)\ole32.lib \
    $(SDK_LIB_PATH)\oleaut32.lib \
    $(SDK_LIB_PATH)\uuid.lib \

UMTYPE=console
UMBASE=0x400000

service.cpp:

#include <iostream>
#include <cstddef>

namespace std {
        typedef ::ptrdiff_t ptrdiff_t; // DDK C++ workaround
}

#include <boost/lambda/lambda.hpp>

int __cdecl main() {
    return 0;
}

解决方案

Boost may already include a work-around for your issues, but isn't applying it because it doesn't recognise the compiler you're using (probably because drivers rarely use boost).

Try examining (and possibly editing) boost/config/select_compiler_config.hpp and boost/config/compiler/visualc.hpp to make sure the compiler workarounds for MSVC are enabled.

这篇关于在WDK使用boost构建应用程序的环境呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆