none
How do I use boost library in WDK environment RRS feed

  • Question

  • I wanna to compile my c plus plus project that using boost library in WDK rather than VisualStudio.

    My computer's OS is Windows7-64bit, the WDK version is 7.6 and boost library version is 1.51

    Once I compile my source code project, the WDK compiler will occure an error:e:\lib\boost_1_51_0\boost\array.hpp(72) : error C2039: 'ptrdiff_t' : is not a member of 'std' .

    Whole project's file contents are as follow:

    File sources:

    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

    File 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;
    }

    Could you please teach me how to solve this problem? Any help will be greatly appreciated!




    • Edited by ddx_xyz Wednesday, September 12, 2012 6:11 AM
    Wednesday, September 12, 2012 2:58 AM