使用boost库,vc++编译出现无法转换error c2440,请大家指点一下如何解决
使用boost库,vc++编译出现无法转换error c2440,请大家指点一下怎么解决把一个从linux下的程序移植了过来,
使用boost库,vc++编译出现无法转换error c2440,请大家指点一下怎么解决
把一个从linux下的程序移植了过来,其中用到了boost库
在build的时候,在语句
C/C++ codestd::string fileName = dirItr->path().filename();
出现了如下的错误
1>.\HoughTrack1.0\code\capture.cpp(100) : error C2440: 'initializing' : cannot convert from 'boost::filesystem3::path' to 'std::basic_string<_Elem,_Traits,_Ax>'
我有些费解怎么解决这个问题,请大家解答前来拿分
[解决办法]std::string firstFile = boost::filesystem::path(first->name()).leaf().string();
also note that the leaf function is deprecated and is removed in Boost.Filesystem V3.
[解决办法]LZ用的是filesystem的V2还是V3?旧些的boost版本默认V2,最近默认V3了,是不是这个问题
[解决办法]filename返回的类型是path模板参数的类型。你的path的模板参数是什么类型呢?
[解决办法]std::string fileName(dirItr->path().filename());这样不知道是否可以
[解决办法]看了下源码,返回的类型是string。你#include<string>没呢?
[解决办法]C/C++ code dirItr->path().filename()