⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

[SOLVED] debug and release CONFIG options and .pro file

  • In my project's build steps the qmake call is configured with "CONFIG+=debug" when Debug configuration is selected.

    Is this addition of debug applicable when the .pro file is parsed? I had assumed that this is the primary purpose, so that the .pro file can be set to do different things when using Debug or Release configurations by checking


    for example. For some reason though these


    functions don't work correctly. Specifically when adding libraries.

    The following behaves differently with Debug configuration selected:

    CONFIG(debug): LIBS += -L../build-MyLibrary-Desktop_Qt_5_0_2_MinGW_32bit/debug/ -lMyLibrary
    CONFIG(release): LIBS += -L../build-MyLibrary-Desktop_Qt_5_0_2_MinGW_32bit/release/ -lMyLibrary

    to when I simply say this:

    LIBS += -L../build-MyLibrary-Desktop_Qt_5_0_2_MinGW_32bit/debug/ -lMyLibrary

    Both compile, but when running the application the latter works, the former doesn't. I would have thought both would work. I did do multiple cleans and qmakes and things to make sure.

    I'm using Qt Creator 2.7.0 based on Qt 5.0.2 win MinGW on Windows 7.

    Edit: I should add that the library creates TCP server and client sockets. The symptom of "not working" is that the client can't connect to the locally hosted server on Windows firewall does ask me if I want to add a rule and I do so. This may be firewall related, but still, there should be NO difference between the two ways of configuring exactly the same thing, right?

  • Lifetime Qt Champion


    One correct test example:

    @CONFIG(release, debug|release) {
    #do what your need when building in release

    As for your network question, you should rather create a new thread with it

  • Thanks, the addition of


    in both cases did the trick. The network discussion wasn't a new question but rather expanding on the symptoms. But it works now, so I consider this solved :)

Log in to reply