Qt World Summit: Register Today!

[Solved] Remove linker error for a library that is not being used anymore

  • I picked up some code related to implementing OAuth2 for Facebook. It uses QJson library to convert Facebook responses into JSON document (and then QVariantMap). However, as I am using Qt5, I decided to replace QJson with QJsonDocument.

    After removing the references to QJson in the code, I also removed its reference from the LIBS attribute in project.pro file.

    Here is the .pro file:

    @##### Autogenerated starts here! ######

    Add more folders to ship with the application, here

    folder_01.source = qml/facebookauth
    folder_01.target = qml

    Additional import path used to resolve QML modules in Creator's code model


    The .cpp file which was generated for your project. Feel free to hack it.

    SOURCES += main.cpp

    Please do not modify the following two lines. Required for deployment.


    Autogenerated ends here!

    TARGET = facebookauth
    TEMPLATE = app
    QT += webkit network widgets

    macx {
    CONFIG -= app_bundle
    QMAKE_POST_LINK += install_name_tool -change kqoauth.framework/Versions/0/kqoauth
    ../../lib/kqoauth.framework/Versions/0/kqoauth $${TARGET}
    else:unix {

    the second argument (after colon) is for

    being able to run make check from the root source directory

    LIBS += -L../../lib:lib
    } else:windows {
    LIBS += -L../../lib -lkqoauth0

    LIBS += -Lqjson/lib -lqjson0

    INCLUDEPATH += qjson/src

    HEADERS +=

    However, compiling the project gives me the following error:

    @:-1: error: LNK1104: cannot open file 'qjson0.lib'@

    As per my understanding, compiler/linker shouldn't be bothered by that lib anymore as I have removed its reference from my project.

    Can anyone guide me to a solution?

  • Have you run qmake?

  • Well, I am using Qt Creator. I ran "clean" and then "rebuild". Is there anything more required?
    I could go command line if you think it is required.

  • [quote author="mrdebug" date="1374766280"]Have you run qmake?[/quote]

    Alright. After you posted this, I thought of deleting the build folder of the project, and then rebuilding it. And it worked!

    I had assumed that clean and rebuild should have done this for me.

    Out of curiosity, what exactly do they do, if not cleaning up the non-existent library links?

Log in to reply