Qt World Summit: Submit your Presentation

Using Valgrind on Windows

  • Hello !

    I try to use the valgrind tool on my Windows 7 so I install Ubuntu on a VM with VirtualBox.
    The problem is I don't manage to connect QtCreator with my host.

    I installed open-ssh server on my Linux. I managed to connect Putty with my server but when I try with QtCreator, the message is :
    Time limit exceeded while waiting for server response.

    I don't understand what's wrong !

  • hello

    If you want to use Valgrind , you have to recompile your project under Linux, so you have to install in your linux at least Qt. If you install the SDK, you have QtCreator and you can compille in the same way as Windows.

    When you have the program on linux you can run Valgrind

    But you can have a problen on Windows and not on Linux.

    Best regards

  • Same problem with me, I'm using Qt creator 2.6.2.
    I can't compile on linux because I'm using some win libraries.

  • Caveat. Though I've used Valgrind a lot, I've never used it on Windows.

    There is a port to Windows on Sourceforge.


    Not too sure how up to date it is, or how well it would work with Qt Creator.


  • Well, finally I ported my code to Linux, with little pain actually!
    Now I can check memory leaks.

    Just used pre-processor definitions to skip the code for win:

    #ifdef Q_OS_WIN
    #include <windows.h>
    #include <direct.h>

    bool Class::openComPort(const QString& port)
    bool result=false;
    /// windows code
    return result;

    bool Class::openComPort(const QString& port)
    return false;

  • Just to add another option:
    (I have not tried it myself, but there is plenty of documentation out there about this method)
    Instead of compiling under linux, compile "normal" for windows, but let it run under wine on linux. Which in turn runs under valgrind.

    "see here":http://wiki.winehq.org/Wine_and_Valgrind

Log in to reply