Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. System function doesn't work anymore after deploy
QtWS25 Last Chance

System function doesn't work anymore after deploy

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 5 Posters 2.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RekTek249
    wrote on last edited by
    #1

    Hey, I'm using curl. I have the following code been used to send an email:

    QString cmd = "curl smtp://smtp.gmail.com:587 -v --mail-from \"xxxxxxxxxx@gmail.com\" --mail-rcpt \"xxxxxxxxx@gmail.com\" --ssl -u xxxxxxxxxxx@gmail.com:xxxxxxxxxxxxxx-T \"msg.txt\" -k --anyauth";
    const char* ccmd = cmd.toStdString().c_str();
    WinExec(ccmd, SW_HIDE);
    
    

    It works fine in Qt Creator Debug but when I "Deploy" it, it doesn't work anymore. Here is how I deployed it. { Qt Console >> cd <MyPathToMyProject> >> windeployqt --gui . } Thanks for your help...

    jsulmJ 1 Reply Last reply
    0
    • Vinod KuntojiV Offline
      Vinod KuntojiV Offline
      Vinod Kuntoji
      wrote on last edited by
      #2

      @RekTek249 ,

      May be some dll's and libraries will be missing.

      C++, Qt, Qt Quick Developer,
      PthinkS, Bangalore

      1 Reply Last reply
      2
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        make sure curl have all needed dlls also.

        1 Reply Last reply
        3
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          Why using WinExec rather than QProcess? but, most importantly, why using curl.exe rather than the libcurl API?

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          R 1 Reply Last reply
          1
          • VRoninV VRonin

            Why using WinExec rather than QProcess? but, most importantly, why using curl.exe rather than the libcurl API?

            R Offline
            R Offline
            RekTek249
            wrote on last edited by
            #5

            @VRonin Because I didn't find any code for libcurl in c++... And I'm using WinExec because I had no idea QProcess existed. I'll google that and try replacing it with that... @Vinod-Kuntoji @mrjj I use the same that in debug, it should work...

            VRoninV 1 Reply Last reply
            0
            • R RekTek249

              @VRonin Because I didn't find any code for libcurl in c++... And I'm using WinExec because I had no idea QProcess existed. I'll google that and try replacing it with that... @Vinod-Kuntoji @mrjj I use the same that in debug, it should work...

              VRoninV Offline
              VRoninV Offline
              VRonin
              wrote on last edited by
              #6

              @RekTek249 said in System function doesn't work anymore after deploy:

              Because I didn't find any code for libcurl in c++.

              It's literally on libcurl's website: https://curl.haxx.se/libcurl/bindings.html

              "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
              ~Napoleon Bonaparte

              On a crusade to banish setIndexWidget() from the holy land of Qt

              1 Reply Last reply
              1
              • mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by mrjj
                #7

                Hi

                • I use the same that in debug, it should work...

                When you run the app in Creator (both release/debug) it has a runtime environment setup including paths for dlls etc.

                When you run it outside in a folder, its not setup same way.

                You could use
                http://www.dependencywalker.com/
                to see if any is listed as missing.
                I would examine the curl.exe first to see what it needs.

                windeployqt cannot know if curls need anything to run as its external app.

                1 Reply Last reply
                2
                • R RekTek249

                  Hey, I'm using curl. I have the following code been used to send an email:

                  QString cmd = "curl smtp://smtp.gmail.com:587 -v --mail-from \"xxxxxxxxxx@gmail.com\" --mail-rcpt \"xxxxxxxxx@gmail.com\" --ssl -u xxxxxxxxxxx@gmail.com:xxxxxxxxxxxxxx-T \"msg.txt\" -k --anyauth";
                  const char* ccmd = cmd.toStdString().c_str();
                  WinExec(ccmd, SW_HIDE);
                  
                  

                  It works fine in Qt Creator Debug but when I "Deploy" it, it doesn't work anymore. Here is how I deployed it. { Qt Console >> cd <MyPathToMyProject> >> windeployqt --gui . } Thanks for your help...

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @RekTek249 said in System function doesn't work anymore after deploy:

                  QString cmd = "curl smtp://smtp.gmail.com:587 -v --mail-from "xxxxxxxxxx@gmail.com" --mail-rcpt "xxxxxxxxx@gmail.com" --ssl -u xxxxxxxxxxx@gmail.com:xxxxxxxxxxxxxx-T "msg.txt" -k --anyauth";
                  const char* ccmd = cmd.toStdString().c_str();

                  One note: why do you create a QString first and then a char*? The QString in this case isn't needed, just do:

                  char* cmd = "curl smtp://smtp.gmail.com:587 -v --mail-from \"xxxxxxxxxx@gmail.com\" --mail-rcpt \"xxxxxxxxx@gmail.com\" --ssl -u xxxxxxxxxxx@gmail.com:xxxxxxxxxxxxxx-T \"msg.txt\" -k --anyauth";
                  

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  2

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved