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. Debugging Qt program with Microsoft VIsual Studio 2013
QtWS25 Last Chance

Debugging Qt program with Microsoft VIsual Studio 2013

Scheduled Pinned Locked Moved General and Desktop
7 Posts 2 Posters 2.7k 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
    rudshel
    wrote on last edited by
    #1

    Hello!
    I created a complex program based on different modules which load after program has started. The program structure is very similar to QtCreator. Frankly speaking I've taken part of code from QtCreator. (plugin management system)
    I'm trying to debug my program with Visual Studio 2013. Very often the debugger doesn't show correct values and skip lines of code. It seems to me that pdb file doesn't correspond to the proper file. How is that may be possible? Should I set specific or additional parameters for debugging Qt programs in MSVS 2013? What might be the reason of such behaviour of debugger?

    I installed Qt 5.4.1 for Windows 32-bit (VS 2013, 705 MB) along with Visual Studio Add-in 1.2.4 for Qt5 (156 MB) properly.

    K 1 Reply Last reply
    0
    • R rudshel

      Hello!
      I created a complex program based on different modules which load after program has started. The program structure is very similar to QtCreator. Frankly speaking I've taken part of code from QtCreator. (plugin management system)
      I'm trying to debug my program with Visual Studio 2013. Very often the debugger doesn't show correct values and skip lines of code. It seems to me that pdb file doesn't correspond to the proper file. How is that may be possible? Should I set specific or additional parameters for debugging Qt programs in MSVS 2013? What might be the reason of such behaviour of debugger?

      I installed Qt 5.4.1 for Windows 32-bit (VS 2013, 705 MB) along with Visual Studio Add-in 1.2.4 for Qt5 (156 MB) properly.

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @rudshel
      Hi and welcome to devnet

      In most cases when the debugger does not follow the code lines as expected, it is simply a mismatch of code lines and objects.
      Rerun qmake and make a rebuild which shall cure the problem.

      Vote the answer(s) that helped you to solve your issue(s)

      R 1 Reply Last reply
      0
      • K koahnig

        @rudshel
        Hi and welcome to devnet

        In most cases when the debugger does not follow the code lines as expected, it is simply a mismatch of code lines and objects.
        Rerun qmake and make a rebuild which shall cure the problem.

        R Offline
        R Offline
        rudshel
        wrote on last edited by rudshel
        #3

        @koahnig
        Thanks for the answer!
        So, you mean I must run qmake in console outside of MSVS and then make a rebuild from MSVS?

        ps. I've made cleanup and rebuild several times within MSVS.

        K 1 Reply Last reply
        0
        • R rudshel

          @koahnig
          Thanks for the answer!
          So, you mean I must run qmake in console outside of MSVS and then make a rebuild from MSVS?

          ps. I've made cleanup and rebuild several times within MSVS.

          K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          @rudshel
          I have stopped using MSVC a while ago. Therefore I do not remember how to do it from MSVC.

          As you might know, you could use also Qt creator together with MSVC compiler.
          In Qt creator you would basically "run qmake" and then "rebuild".
          However, in my personal experience I found it sometimes saver to delete all compiled objects, libs and exes and did recompilation. Then you are sure than all is really compiled.
          Note, this experience is merely based on using MinGW compiler suite.

          As far as I remember there is a db created by MSVC which holds all information for debugging. Extension .ndb(?). Make a copy and remove it as well.

          Vote the answer(s) that helped you to solve your issue(s)

          R 1 Reply Last reply
          0
          • K koahnig

            @rudshel
            I have stopped using MSVC a while ago. Therefore I do not remember how to do it from MSVC.

            As you might know, you could use also Qt creator together with MSVC compiler.
            In Qt creator you would basically "run qmake" and then "rebuild".
            However, in my personal experience I found it sometimes saver to delete all compiled objects, libs and exes and did recompilation. Then you are sure than all is really compiled.
            Note, this experience is merely based on using MinGW compiler suite.

            As far as I remember there is a db created by MSVC which holds all information for debugging. Extension .ndb(?). Make a copy and remove it as well.

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

            @koahnig
            I tried to clean all the stuff and it didn't help...

            1 Reply Last reply
            0
            • R Offline
              R Offline
              rudshel
              wrote on last edited by
              #6

              Finally I solved this problem.

              Go to project property pages-> C/C++ ->Optimization. Set 'Optimization' property to 'Disabled(/Od)'. That's all! :)

              K 1 Reply Last reply
              0
              • R rudshel

                Finally I solved this problem.

                Go to project property pages-> C/C++ ->Optimization. Set 'Optimization' property to 'Disabled(/Od)'. That's all! :)

                K Offline
                K Offline
                koahnig
                wrote on last edited by
                #7

                @rudshel
                Makes somehow sense ;)

                Vote the answer(s) that helped you to solve your issue(s)

                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