Simple change in *.pro file and libraries no longer get found



  • The only thing I changed was

    INCLUDEPATH += $$PWD/../../../Boost/include
    DEPENDPATH += $$PWD/../../../Boost/include
    

    to this

    INCLUDEPATH += $$PWD/../../../Boost/include/boost_1_60
    DEPENDPATH += $$PWD/../../../Boost/include/boost_1_60
    

    and I start getting these:
    cannot find -llibgenieutils.dll
    cannot find -llibboost... etc
    error: ld returned 1 exit status

    If I undo my changes to the pro file, nothing changes. How can I make Qt Creator work again? If I add those libraries again, I will get 100 % same code to Boost include paths. But as soon as I edit something, even if I change it back, the libraries get lost. I had this error before too, but I don't want to use the "Add Library..." wizard every time from mouse right-click.

    Am I not supposed to touch the pro file myself? I even deleted my build folders, but the problem persists.

    EDIT: I confirmed that this is a bug in qmake or whatever is responsible for finding the libraries, as I changed and changed the pro file trying to make it work, but eventually I changed it back to ...include/boost_1_60 etc and it suddenly works (only for debug this time). So 100 % same pro file works sometimes and sometimes not. It also varies whether it works for both release and debug builds or only one of them.

    EDIT2: Apparently I managed to do debug build only once, then Qt Creator refused to find the libraries again.


  • Qt Champions 2016

    hi
    when u have changed the pro file.
    you should run qmake from the menu.
    If its still funky, you can try to clean the build folder.

    Also, are you 100% sure its the only place that Boost is mentioned?
    there is not a LIBS += line or something like that?



  • Thanks :) looks like running qmake solves this... or not (only for debug build it did). I am getting program exited with code 0 in release build and then cannot find again. I ran clean/qmake/rebuild multiple times, still no luck.

    There is LIBS += but it worked before and I did not touch it at all.

    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../genieutils-build/release/ -llibgenieutils.dll
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../genieutils-build/debug/ -llibgenieutils.dll
    
    INCLUDEPATH += $$PWD/../genieutils/include
    DEPENDPATH += $$PWD/../genieutils/include
    
    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../Boost/lib/ -llibboost_iostreams-mgw49-mt-1_60.dll
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../Boost/lib/ -llibboost_iostreams-mgw49-mt-d-1_60.dll
    
    INCLUDEPATH += $$PWD/../../../Boost/include/boost_1_60
    DEPENDPATH += $$PWD/../../../Boost/include/boost_1_60

  • Qt Champions 2016

    Hmm
    debug and release do look very much alike to me.
    So both should work.


  • Qt Champions 2016

    @Tapsa
    Hello,

    win32:CONFIG(release, debug|release): LIBS += -L$PWD/../genieutils-build/release/ -llibgenieutils.dll
    

    Do you have a file that's called liblibgenieutils.dll.lib, if not then you're using the flags wrong.
    qmake's -l flag will add the appropriate prefixes and suffixes for your platform, so you should use it accordingly:

    win32:CONFIG(release, debug|release): LIBS += -L$PWD/../genieutils-build/release/ -lgenieutils
    

    Kind regards.



  • Thank you, kshegunov.
    Removing "lib" and ".dll" seems to work for both release and debug builds now. Those were added by the "Add Library..." method of Qt Creator.


  • Qt Champions 2016

    @Tapsa

    Those were added by the "Add Library..." method of Qt Creator.

    This seems very improbable. To be sure however, I've used the "Add library" wizard for a chosen external library from another project and QtCreator generates the following for the .pro file:

    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../ag/bin-debug/release/ -lagcore
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../ag/bin-debug/debug/ -lagcore
    else:unix: LIBS += -L$$PWD/../../ag/bin-debug/ -lagcore
    
    INCLUDEPATH += $$PWD/../../ag/bin-debug
    DEPENDPATH += $$PWD/../../ag/bin-debug
    

    As you can see there's neither "lib" prefix, nor ".so" extension in the generated code. Additionally notice that PWD is used with double dollar symbols, and not as $PWD. Either there's a bug in your creator, or you'd changed the generated code and forgot about it.

    Kind regards.



  • I did not change those LIB lines and add library (external) only allowed me to choose *.A files. Thanks for pointing out that double dollar glitch too (phew, it was caused by this forum formatting). I am 100 % sure of this since I tried to use that add library multiple times and the result was same. I have static *.A and shared *.DLL.A and *.DLL I chose the *.DLL.A and got that -llibname.dll line.


  • Qt Champions 2016

    @Tapsa
    .a files are static libraries and additional instructions to qmake are needed to link them, but in any case I wouldn't wish to stray in that direction.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.