Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Terminal Program won't run from the prompt



  • My terminal program compiles and runs from Qt Creator, but when I try to run it from PowerShell, it quietly do not run.

    #pragma warning(default: 4290)
    #include <QCoreApplication>
    
    
    #include "abc.hpp"
    #include "ascii/ascii.hpp"
    
    using namespace std;
    void DisplayEs();
    void DisplayFr();
    int main(int argc, char *argv[])
    {
        QCoreApplication a(argc, argv);
    
        if (argc > 1) {
            // convert argv[1] to a std::string
            QString str = argv[1];
            if ( str.compare("es") == 0 || str.compare("ES") == 0)  {
                DisplayEs();
                abc::ascii_es();
            }
            if (str.compare("fr") == 0 || str.compare("FR") == 0) {
                DisplayFr();
    
            }
            if (str.compare("?") == 0) {
            std::wcout << L"ascii all" << std::endl
                << L"ascii es" << std::endl
                << L"ascii fr" << std::endl;
            }
            if (str.compare("all") == 0){
                abc::ascii_all();
            }
            else{
                std::wcout << "Need to enter dic";
            }
    
        }
    }
    void DisplayEs() {
    ...
    }
    void DisplayFr() {
    ...
    }
    
    

    Did I do something wrong?


  • Lifetime Qt Champion

    Hi,

    Since you are executing it out of Qt Creator, you have to use the same steps as for a deployment. You can use windeployqt to get your executable dependencies in the same folder so you can run it properly.

    Hope it helps



  • The key to deployment is windeployqt. I found a video in Spanish Here and Qt also has a mute version here.
    Thanks SGaist!


  • Lifetime Qt Champion

    You're welcome !

    Since you have it working now, please mark the thread as solved using the "Topic Tool" button so other forum users may know a solution has been found :)



  • Topic Tools button? I cannot find it!


  • Lifetime Qt Champion

    There's one under the original post and one at the bottom of the page.


Log in to reply