'plugin and paint' example cannot open file "plugin\pnp_basictoolsd.lib" error



  • I am learning from official Qt5.0.2 examples. I have plugandpaint and plugandpaintplugin example copied into my workspace and built them ok. The lib and dll files are created in the right location as expected. But when I run the pluginandpaint example, I got above error. By looking at the directory, the files are there.

    Look at the following pro file, I don't know where and what I can add the path:

    @#! [0]
    QT += widgets

    HEADERS = interfaces.h
    mainwindow.h
    paintarea.h
    plugindialog.h
    SOURCES = main.cpp
    mainwindow.cpp
    paintarea.cpp
    plugindialog.cpp

    LIBS = -Lplugins -lpnp_basictools

    if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
    mac:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)_debug
    win32:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)d
    }
    #! [0]

    install

    target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/plugandpaint
    INSTALLS += target
    @

    Then I tried "Add Library" from Creator. The 'Internal library' doesn't allow me to add any files. The "External library" added the following into the pro file:

    @win32:CONFIG(release, debug|release): LIBS += -L$$PWD/plugins/ -lpnp_basictoolsd
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/plugins/ -lpnp_basictoolsdd
    else:unix: LIBS += -L$$PWD/plugins/ -lpnp_basictoolsd

    INCLUDEPATH += $$PWD/
    DEPENDPATH += $$PWD/@

    After "Clean", "Run qmake" and "Rebuild", I got the same error:

    @error: LNK1104: cannot open file 'plugins\pnp_basictoolsd.lib'@

    But the folder and file do exist there. That 'plugins' folder is in the same level as the pro file.

    Where and how I can config to let the Qt knows the lib needed?

    I am using Qt 5.0.2 and windows 7 professional. I didn't change anything on the examples.

    EDIT:

    No magic, keep playing with it and eventually you will find Creator will wake up and do right thing for you.



  • "keep playing with it" - strange solution)
    this solved for me:

    1. build a .lib from "Plug & Paint Basic Tools Example" which has basictools.pro and basictoolsplugin.cpp
    2. put this .lib so that "Plug & Paint Example" (which has plugandpaint.pro) can see that .lib
    3. now you can build&run it

Log in to reply
 

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