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. Commandline arguments
Forum Updated to NodeBB v4.3 + New Features

Commandline arguments

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.9k Views 1 Watching
  • 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.
  • B Offline
    B Offline
    browser90
    wrote on last edited by
    #1

    Dear,

    I've just released my app, and in Qt creator everything works even with the command line args. But when in release mode and I go to my CMD and type something like test.exe 1 1 the program doesn't do anything...

    This is the way I get the args:
    @int main(int argc, char *argv[]) @

    Can someone help me?

    Kind regards,

    1 Reply Last reply
    0
    • L Offline
      L Offline
      leon.anavi
      wrote on last edited by
      #2

      [quote author="browser90" date="1357154070"]I go to my CMD and type something like test.exe 1 1 the program doesn't do anything...

      This is the way I get the args:
      @int main(int argc, char *argv[]) @
      [/quote]

      This is just a declaration of the main method. Please post more source code form your app. What do you do with the arguments that are passed from the command line?

      http://anavi.org/

      1 Reply Last reply
      0
      • B Offline
        B Offline
        browser90
        wrote on last edited by
        #3

        I use them in a thread and then I show a QLabel were I put some QImages on and that's it.

        When I run my app in QT everything works like a charm. It's just when I make a release exe or debug exe that I want to start from the cmd that it doesn't show my QLabel.. I've got every DLL that I need...

        1 Reply Last reply
        0
        • M Offline
          M Offline
          MuldeR
          wrote on last edited by
          #4

          How can you use main(int argc, char *argv[]) in a thread?

          The main function is the entry point of your app and what the "main" thread will execute first.

          If you create additional threads, they won't start from the "main" function!!

          Instead whatever API you use to create the thread will ask for a pointer to the thread "start" function.

          BUT: None of the thread API's I know (Win32, pthreads, QThread) has this signature for the "start" function:
          @int (*main)(int argc, char *argv[])@

          Instead it's usually something like:
          @void* (*start)(void *param)@

          So how do the values of argc and argv get into your thread's start function?

          My OpenSource software at: http://muldersoft.com/

          Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

          Go visit the coop: http://youtu.be/Jay...

          1 Reply Last reply
          0

          • Login

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