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

Modifying Makefiles directly...the right way to do it?

  • Hi all-

    Okay, I've been playing around with QT long enough that I'm starting to work with "real" projects that require including other libraries. Being used to IDEs like Eclipse and VS, I figured I'd add my additional library paths somewhere in QT Creator, and it kind of looks like that with the "Make arguments" edit box, but it appears that does not seem to actually affect the build.

    I went into the build directory and modified the Makefile.Debug and Makefile.Release files directly to include my extra -I and -L parameters, and it built correctly.

    I couldn't find any specific information about what is the "right" way to do this; is modifying the files the proper way to do it? I don't mind modifying the files directly, but wanted to make sure they weren't going to get deleted then recreated by QT Creator for some reason, losing my changes.

    Thanks for any info,


  • Please do not modify the generated Makefiles. Your changes will get overridden as soon as you run qmake. Edit the .pro-file instead (syntax is much nicer too, at least as long as you do simple things:-) and run qmake again.

  • See "Declaring Other Libraries":http://doc.qt.nokia.com/4.7/qmake-project-files.html#declaring-other-libraries in the qmake docs for enhancing your .pro file. Whenever you re-run qmake the changes in the generated makefiles are overwritten.

  • Thanks a lot for the info; I didn't find that section in the documentation (I guess sometimes Google isn't my friend ;))

  • You're welcome. Sometimes the old aunt google is picky about what she's telling you :-)

Log in to reply