How to concretely fix the following error message: what(): basic_string::_S_construct null not valid

  • Hello,

    Each time I try to run this code, the unix terminal shows me the following error message:

      *  terminate called after throwing an instance of 'std::logic_error'
        what():basic_string::_ S_construct null not valid
        Press <RETURN> to close this window...*

    This is my code:


    using namespace std;
    using namespace cv;

    int main(int argc,char **argv){

     //Create a window
     namedWindow( argv[1], WINDOW_AUTOSIZE );
     //Load an image
     Mat image=imread( argv[1] );
     //Show the image in the window
     imshow( argv[1] );
     //Clean up
     destroyWindow( argv[1] );
     exit( 0 );


    Could you tell me how to concretely fix this problem please?
    Thank you in advance

    Information: Operating system: LinuxMint 17
    I am working with OpenQt 3.1.2 (opensource)

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Unless I'm missing something, this is not related to Qt. You should ask this question on the OpenCV forums

Log in to reply

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