Unsolved what is the "../" meaning in 'LIBS = -L../plugins' when load plugins
-
hello:
I learn load plugin in qt in mac by following the 'Plug & Paint Example' which is in Qt's example, so I create a new project to follow the 'Plug & Paint Example' project, in the app.pro which belongs to 'Plug & Paint Example' project, here is app.pro the information :#! [0]
TARGET = plugandpaint
DESTDIR = ..QT += widgets
HEADERS = interfaces.h
mainwindow.h
paintarea.h
plugindialog.h
interfaces.h
SOURCES = main.cpp
mainwindow.cpp
paintarea.cpp
plugindialog.cppLIBS = -L../plugins
macx-xcode {
LIBS += -lpnp_basictools$($${QMAKE_XCODE_LIBRARY_SUFFIX_SETTING})
} else {
LIBS += -lpnp_basictools
message($$member(LIBS, 0)----$$member(LIBS, 1))
if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
mac:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)_debug
# mac:LIBS = $$member(LIBS, 0)_debug -L../plugins
win32:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)
}
}
#! [0]install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/plugandpaint
INSTALLS += targetCONFIG += install_ok # Do not cargo-cult this!
when I run the 'Plug & Paint Example' project, everything works fine just as we expect,
so I follow the 'Plug & Paint Example' project create a new project which name 'PlugAndPaintExample',
here is my PlugAndPaintExample.pro in the 'PlugAndPaintExample' project:
TARGET = PlugAndPaintExample
DESTDIR = ..QT += widgets
HEADERS +=
interfaces.h
mainwindow.h
paintarea.h
plugindialog.hSOURCES +=
mainwindow.cpp
paintarea.cpp
plugindialog.cpp
main.cppLIBS += -L../plugins
macx-xcode {
LIBS += -lpnp_basictools$($${QMAKE_XCODE_LIBRARY_SUFFIX_SETTING})
} else {
LIBS += -lpnp_basictools
message($$member(LIBS, 0)----$$member(LIBS, 1))
if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
mac:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)_debug
# mac:LIBS = $$member(LIBS, 0)_debug -L../plugins
win32:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)
}
}install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/plugandpaint
INSTALLS += targetCONFIG += install_ok # Do not cargo-cult this!
when I run the PlugAndPaintExample project,it will show me the error:
ld: warning: directory not found for option '-L../plugins'
ld: library not found for -lpnp_basictools_debug
clang: error: linker command failed with exit code 1 (use -v to see invocation)I confirm I had added the plugins directory in the correct path, why in my 'PlugAndPaintExample' it shows the error,but the 'Plug & Paint Example' won't,
after that, I change 'LIBS = -L../plugins' to 'LIBS =-L$$PWD/../plugins' in PlugAndPaintExample.pro in the 'PlugAndPaintExample' project, it works fine, I don't know why, this makes me confused.
thanks a lot! -
"../" means the parent directory of the current directory. So if the current directory was /home/bob/Documents, "../" would mean /home/bob, just like when you 'cd ..' on the command line.
-
@wrosecrans
thanks for your help!