4.
// std::ofstream ofile;
ofile<<std::string(str);  
 error C2440: '<function-style-cast>' : cannot convert from 'CString' to 'std::string'
        No constructor could take the source type, or constructor overload resolution was ambiguous5.
 string str1(str);
error C2664: 'std::basic_string<_Elem,_Traits,_Ax>::basic_string(const std::allocator<_Ty> &)' : cannot convert parameter 1 from 'CString' to 'const std::allocator<_Ty> &'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Ax=std::allocator<char>,
            _Ty=char
        ]
        and
        [
            _Ty=char
        ]
        Reason: cannot convert from 'CString' to 'const std::allocator<_Ty>'
        with
        [
            _Ty=char
        ]
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called6.

解决方案 »

  1.   

      CString filename = GetCurrWorkingDir()+"test.pdf";
      if(pdf.begin_document(filename.GetBuffer(0),_T("")) == -1)
     error C2664: 'PDFlib::begin_document' : cannot convert parameter 1 from 'wchar_t *' to 'std::string'
            No constructor could take the source type, or constructor overload resolution was ambiguous
      

  2.   

    那就不要用string了,因为string的定义
    typedef basic_string<char, char_traits<char>, allocator<char> >
    string;
    typedef basic_string<wchar_t, char_traits<wchar_t>,
    allocator<wchar_t> > wstring;string 是用于非unicode的,而wstring是用于unicode的。所以这里就不能用统一的代码写了。建议函数参数使用TCHAR *.
      

  3.   

    既然是空的,那么就定义一个std::string是空的,
    这个可能是因为wchar_t*和std::string之间没有提供转化函数所导致。