Search code examples
c++boostcharconstantsvalue-type

C++ boost error: cannot convert const value type* (aka const wchar_t*) to const char* in initialization


I'm trying to search for a word from a file using the boost module and c++ and I'm stuck on this error message:

error: cannot convert 'const value_type* {aka const wchar_t*}' to 'const char*' in initialization

The error comes from this line of code:

const char* file_path = itr->path ().filename ().c_str();

Thanks.


Solution

  • It is telling you you need this:

    const wchar_t* file_path = itr->path ().filename ().c_str();