【发布时间】:2012-09-12 07:27:05
【问题描述】:
我想编译我的 c plus plus 项目,它使用带有 WDK 而不是 VisualStudio 的 boost 库。
我的电脑操作系统是Windows7-64bit,WDK版本是7.6,boost库版本是1.51
一旦我编译了我的源代码项目,WDK编译器就会出错:
e:\lib\boost_1_51_0\boost\array.hpp(72) : error C2039: 'ptrdiff_t' : is not a member of 'std' .
整个项目的文件内容如下:
文件来源:
TARGETTYPE=PROGRAM
TARGETNAME=helloworld
UMENTRY=main
USE_MSVCRT=1
USE_NATIVE_EH=1
#
# use iostream package and STL
#
USE_IOSTREAM=1
USE_STL=1
STL_VER=70
#
# my boost library root directory
#
BOOST_INC_PATH=E:\lib\boost_1_51_0
INCLUDES=$(BOOST_INC_PATH)
TARGETLIBS=$(SDK_LIB_PATH)\user32.lib
SOURCES=HelloWorld.cpp
UMTYPE=console
UMBASE=0x4000000
文件 HelloWorld.cpp:
#include <iostream>
#include <vector>
#include <string>
#include <boost/array.hpp>
void InvokeVector()
{
//invoke STL's vector
std::vector<std::string> vec;
vec.push_back("Entry ");
vec.push_back("of ");
vec.push_back("Vector");
vec.push_back("……\n");
//print vec
for (int i=0; i<vec.size(); i++) {
std::cout<<vec.at(i);
}
}
void InvokeBoost()
{
//invoke Boost's array<T, N>
boost::array<int, 3> arr = {1, 2, 3};
for (int i=0; i<arr.size(); i++) {
std::cout<<"arr["<<i<<"]"<<"is" <<arr[i]<<std::endl;
}
}
int main()
{
// InvokeVector(); //run normally
InvokeBoost(); //it will occure an error
return 0;
}
你能教我如何解决这个问题吗?任何帮助将不胜感激!
【问题讨论】:
-
我怀疑您是否可以在 WDK 中“按原样”使用 boost,请参阅以下链接:stackoverflow.com/questions/718309/…。但是,您可以尝试修补所需的 boost 库。
-
你的项目是驱动吗?如果没有,为什么要使用 WDK 构建它?
-
亲爱的 Igor R:我正在开发一个 dokan 库用户模式应用程序,dokan 库要求使用 WDK 但 vs2010 构建,所以,我很困惑如何在 WDK 环境中构建我的 dokan 应用程序。跨度>