Qt World Summit: Register Today!

Qmake: How to pass linker flags?

  • I am trying to pass a linker flag to VS2010.

    Currently I am using

    but that doesn't work, the flag does not appear in the resulting makefile.

    How do I pass linker flags correctly?

  • Moderators

    There's also:

    But the standard one you've used should work. Or try adding your flags to LIBS, maybe that would work.

  • According to the qmake docs, LIBS would not be for that. It also doesn't affect the makefile.

    I've now tried without any conditions, and verified using 'message' that the QMAKE_LFLAGS and/or QMAKE_LFLAGS_WINDOWS are set correctly. They are.
    As a side node, none of the other options already in the QMAKE_LFLAGS appear in the makefile.

    Mystified & Frustrated...

  • I am having the same issue. Really? The QMAKE_LFLAGS setting really doesn't work?

    How is this possible? I am astonished.

    Would the current Qt team like me to investigate why this is failing?

  • After looking carefully at what is going on - Doing a "Clean All" and then rebuild through Qt Creator is not sufficient to pick up any changes to the linker flags such as those provided by the QMAKE_LFLAGS entry in the .pro file.

    You need to actually delete the entire debug / delete build directory, and then do a rebuild.

    Then, the linker flags take effect.

  • Another option is to re-run qmake after you have changed .pro file.
    Or run "make distclean" to remove all generated files including top-level Makefile, so next build will re-recreate Makefile with new options.

  • Yep! The Makefile is not regenerated...

Log in to reply