Qt World Summit: Register Today!

visual studio to qt

  • Hello forum,

    I am a simple console application running in C++ that runs fine over visual studio. Now I am trying to port the application to Qt using Qt creator. While doing it, I am encountering the following issues :

    1. The argc arguement showing different values in Qt. I am getting 1 in visual studio debugger , but getting 2 while running the debugger with Qt creator and this value is changing the logic of the application - ending up with some exception generated by the application. Any hint to get around this issue ?


  • One more interesting thing to point out. I checked the argv[] array . The contents are same both with visual studio debugger and qt creator one. I believe Qt creator is also using the visual studio debugger at the back-end. But the value of argc is 1 when debugging with visual studio and 2 when debugging with qt creator.

    I believe that this tiny detail will help you to come up with some tips to address this issue.


  • @sajis997
    Qt creator is an IDE and it uses external debuggers for debugging. There is no reason to have different results when started under VS or Qt creator.

    Check out in Qt creator on the left side under "Projects" you see the proejct setup. Change to "Run settings" for the kit you are using.
    Porbably there is something set in the Arguments line. This will be passed as argument to your application.

  • Hi

    The "Arguments" textfield is empty. Any where else to look into ?


  • @sajis997
    Can you see in the debugger what is passed as argument?
    You should be able to this. The first argument is the exe including path and what is next element?
    Is the first element correct?

  • @koahnig

    The first argument is as you mentioned - the .exe file. The second argument is -
    67 'C'. I accessed the value from the argv value , I hope this is what you meant.

  • @sajis997
    Yes, that is what I meant.
    Somewhere the extra 'C' must come from. You indicated that the Argumments under "Projects" is empty. Is the line above "Executable" holding only a valid executable name including the path?
    Are there blanks in that path?

  • Let me clear it again. The "Arguments" field is under the "Run" and "Run" is under "Projects".

    And , yes, the "Executable" is holding only a valid executable name including the path.

    Do you not see both 67 and 'C' as extras ? You mentioned only 'C' as the extra argument in your last post. Any explanation ?

    Any where else to look into to get around this issue ?



Log in to reply