Cannot convert cont char* to LPCWSTR



  • hi, I am stuck with an error in QT compiler however it works fine with VS2010. the error states that

    bq. error: C2664: 'HANDLE LoadImageW(HINSTANCE,LPCWSTR,UINT,int,int,UINT)' : cannot convert argument 2 from 'const char *' to 'LPCWSTR'
    Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

    my code is as below

    @Bitmap::Bitmap(std::string const& file_name) {
    bitmap_ = static_cast<HBITMAP>(::LoadImage(0, file_name.c_str(), IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION));
    }@

    please share if you have any idea to resolve this


  • Moderators

    Please use Google, it does not hurt: "link":http://qt-project.org/forums/viewthread/25638.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.