Program using Qt, OpenCV runs fine when started from VS, but running the executable ordinarily crashes when...





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







-1















I'm trying to deploy my C++ program. Every functionality of it works if I run the program from the VS IDE (release mode). When I ordinarily run the same executable, the main window comes up fine and its non-OpenCV functionality works; but when I try to open a picture and have the program use OpenCV stuff (opening it invokes the use of several OpenCV manipulations on the picture), it crashes.



I ran windeployqt from the Developer Command Prompt for VS 2017 successfully. It didn't copy the OpenCV dlls next to my executable, though, so I copied opencv_world400.dll and opencv_ffmpeg400_64.dll next to the other dlls. I assume this is the step where I'm missing something.
The folder looks like this now:
the executabe's folder



I'm using VS2017 with Qt5.10.1 and OpenCV4.0. I don't think I can insert relevant code as the project is quite big and it uses OpenCV functionality extensively.










share|improve this question























  • Have you tried running it through Dependency Walker to see if there's any missing DLLs?

    – MrEricSir
    Jan 4 at 4:09











  • Yes, but once I open it in Dependency Walker the app doesn't respond.

    – toutecrimson
    Jan 4 at 5:12











  • I use Opencv 3.4 with above configuration and had faced similar issue. The problem was, I had not copied opencv .exes like opencv_version.exe , opencv_createsamples.exe. In short, try copying everything in the bin folder next to your qt application

    – Anonymous
    Jan 4 at 8:44











  • Thanks, but this didn't solve the problem either.

    – toutecrimson
    Jan 5 at 18:04


















-1















I'm trying to deploy my C++ program. Every functionality of it works if I run the program from the VS IDE (release mode). When I ordinarily run the same executable, the main window comes up fine and its non-OpenCV functionality works; but when I try to open a picture and have the program use OpenCV stuff (opening it invokes the use of several OpenCV manipulations on the picture), it crashes.



I ran windeployqt from the Developer Command Prompt for VS 2017 successfully. It didn't copy the OpenCV dlls next to my executable, though, so I copied opencv_world400.dll and opencv_ffmpeg400_64.dll next to the other dlls. I assume this is the step where I'm missing something.
The folder looks like this now:
the executabe's folder



I'm using VS2017 with Qt5.10.1 and OpenCV4.0. I don't think I can insert relevant code as the project is quite big and it uses OpenCV functionality extensively.










share|improve this question























  • Have you tried running it through Dependency Walker to see if there's any missing DLLs?

    – MrEricSir
    Jan 4 at 4:09











  • Yes, but once I open it in Dependency Walker the app doesn't respond.

    – toutecrimson
    Jan 4 at 5:12











  • I use Opencv 3.4 with above configuration and had faced similar issue. The problem was, I had not copied opencv .exes like opencv_version.exe , opencv_createsamples.exe. In short, try copying everything in the bin folder next to your qt application

    – Anonymous
    Jan 4 at 8:44











  • Thanks, but this didn't solve the problem either.

    – toutecrimson
    Jan 5 at 18:04














-1












-1








-1








I'm trying to deploy my C++ program. Every functionality of it works if I run the program from the VS IDE (release mode). When I ordinarily run the same executable, the main window comes up fine and its non-OpenCV functionality works; but when I try to open a picture and have the program use OpenCV stuff (opening it invokes the use of several OpenCV manipulations on the picture), it crashes.



I ran windeployqt from the Developer Command Prompt for VS 2017 successfully. It didn't copy the OpenCV dlls next to my executable, though, so I copied opencv_world400.dll and opencv_ffmpeg400_64.dll next to the other dlls. I assume this is the step where I'm missing something.
The folder looks like this now:
the executabe's folder



I'm using VS2017 with Qt5.10.1 and OpenCV4.0. I don't think I can insert relevant code as the project is quite big and it uses OpenCV functionality extensively.










share|improve this question














I'm trying to deploy my C++ program. Every functionality of it works if I run the program from the VS IDE (release mode). When I ordinarily run the same executable, the main window comes up fine and its non-OpenCV functionality works; but when I try to open a picture and have the program use OpenCV stuff (opening it invokes the use of several OpenCV manipulations on the picture), it crashes.



I ran windeployqt from the Developer Command Prompt for VS 2017 successfully. It didn't copy the OpenCV dlls next to my executable, though, so I copied opencv_world400.dll and opencv_ffmpeg400_64.dll next to the other dlls. I assume this is the step where I'm missing something.
The folder looks like this now:
the executabe's folder



I'm using VS2017 with Qt5.10.1 and OpenCV4.0. I don't think I can insert relevant code as the project is quite big and it uses OpenCV functionality extensively.







c++ qt opencv deployment release






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 4 at 2:39









toutecrimsontoutecrimson

544




544













  • Have you tried running it through Dependency Walker to see if there's any missing DLLs?

    – MrEricSir
    Jan 4 at 4:09











  • Yes, but once I open it in Dependency Walker the app doesn't respond.

    – toutecrimson
    Jan 4 at 5:12











  • I use Opencv 3.4 with above configuration and had faced similar issue. The problem was, I had not copied opencv .exes like opencv_version.exe , opencv_createsamples.exe. In short, try copying everything in the bin folder next to your qt application

    – Anonymous
    Jan 4 at 8:44











  • Thanks, but this didn't solve the problem either.

    – toutecrimson
    Jan 5 at 18:04



















  • Have you tried running it through Dependency Walker to see if there's any missing DLLs?

    – MrEricSir
    Jan 4 at 4:09











  • Yes, but once I open it in Dependency Walker the app doesn't respond.

    – toutecrimson
    Jan 4 at 5:12











  • I use Opencv 3.4 with above configuration and had faced similar issue. The problem was, I had not copied opencv .exes like opencv_version.exe , opencv_createsamples.exe. In short, try copying everything in the bin folder next to your qt application

    – Anonymous
    Jan 4 at 8:44











  • Thanks, but this didn't solve the problem either.

    – toutecrimson
    Jan 5 at 18:04

















Have you tried running it through Dependency Walker to see if there's any missing DLLs?

– MrEricSir
Jan 4 at 4:09





Have you tried running it through Dependency Walker to see if there's any missing DLLs?

– MrEricSir
Jan 4 at 4:09













Yes, but once I open it in Dependency Walker the app doesn't respond.

– toutecrimson
Jan 4 at 5:12





Yes, but once I open it in Dependency Walker the app doesn't respond.

– toutecrimson
Jan 4 at 5:12













I use Opencv 3.4 with above configuration and had faced similar issue. The problem was, I had not copied opencv .exes like opencv_version.exe , opencv_createsamples.exe. In short, try copying everything in the bin folder next to your qt application

– Anonymous
Jan 4 at 8:44





I use Opencv 3.4 with above configuration and had faced similar issue. The problem was, I had not copied opencv .exes like opencv_version.exe , opencv_createsamples.exe. In short, try copying everything in the bin folder next to your qt application

– Anonymous
Jan 4 at 8:44













Thanks, but this didn't solve the problem either.

– toutecrimson
Jan 5 at 18:04





Thanks, but this didn't solve the problem either.

– toutecrimson
Jan 5 at 18:04












1 Answer
1






active

oldest

votes


















0














I figured it out, the problem was unrelated to OpenCV (opencv_world400.dll was sufficient to copy into the folder).



The problem was: I used Qt's applicationDirPath(), which returns the executable's path, to access a Results folder I was supposed to have previously created there, but did not. The program, if ran from VS, was accessing the existing Results folder in the Debug folder, even though I was running the program in release mode and applicationDirPath() was returning the executable's path in the Release folder. When I was running the same executable ordinarily, it couldn't find the Results folder and crashed.






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54032487%2fprogram-using-qt-opencv-runs-fine-when-started-from-vs-but-running-the-executa%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I figured it out, the problem was unrelated to OpenCV (opencv_world400.dll was sufficient to copy into the folder).



    The problem was: I used Qt's applicationDirPath(), which returns the executable's path, to access a Results folder I was supposed to have previously created there, but did not. The program, if ran from VS, was accessing the existing Results folder in the Debug folder, even though I was running the program in release mode and applicationDirPath() was returning the executable's path in the Release folder. When I was running the same executable ordinarily, it couldn't find the Results folder and crashed.






    share|improve this answer




























      0














      I figured it out, the problem was unrelated to OpenCV (opencv_world400.dll was sufficient to copy into the folder).



      The problem was: I used Qt's applicationDirPath(), which returns the executable's path, to access a Results folder I was supposed to have previously created there, but did not. The program, if ran from VS, was accessing the existing Results folder in the Debug folder, even though I was running the program in release mode and applicationDirPath() was returning the executable's path in the Release folder. When I was running the same executable ordinarily, it couldn't find the Results folder and crashed.






      share|improve this answer


























        0












        0








        0







        I figured it out, the problem was unrelated to OpenCV (opencv_world400.dll was sufficient to copy into the folder).



        The problem was: I used Qt's applicationDirPath(), which returns the executable's path, to access a Results folder I was supposed to have previously created there, but did not. The program, if ran from VS, was accessing the existing Results folder in the Debug folder, even though I was running the program in release mode and applicationDirPath() was returning the executable's path in the Release folder. When I was running the same executable ordinarily, it couldn't find the Results folder and crashed.






        share|improve this answer













        I figured it out, the problem was unrelated to OpenCV (opencv_world400.dll was sufficient to copy into the folder).



        The problem was: I used Qt's applicationDirPath(), which returns the executable's path, to access a Results folder I was supposed to have previously created there, but did not. The program, if ran from VS, was accessing the existing Results folder in the Debug folder, even though I was running the program in release mode and applicationDirPath() was returning the executable's path in the Release folder. When I was running the same executable ordinarily, it couldn't find the Results folder and crashed.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 6 at 19:13









        toutecrimsontoutecrimson

        544




        544
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54032487%2fprogram-using-qt-opencv-runs-fine-when-started-from-vs-but-running-the-executa%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Monofisismo

            Angular Downloading a file using contenturl with Basic Authentication

            Olmecas