My compiler reports this undefined reference to openWallet(..)
function. As you can see I have linked responding libraries -L/usr/lib -lkdeui -kdecore -lkparts
.
Error:
password.cpp:(.text+0x29): undefined reference to `KWallet::Wallet::openWallet(QString const&, unsigned long long, KWallet::Wallet::OpenType)'
Compile command:
g++ -Wl,-O1 -Wl,-rpath-link,/usr/lib/x86_64-linux-gnu -o password_client "ALL *.o FILES" -L/usr/lib -lkdecore -lkdeui -lkparts -lglib-2.0 -L/usr/X11R6/lib64 -L/usr/lib/x86_64-linux-gnu -lGL -lpthread
Same error is reported by QtCreator. .pro
file contains
LIBS += -lkdecore \
-lkdeui \
-lkparts
I have all that required libs installed. Proof:
Output of nm -D /usr/lib/libkdeui.so | grep openWallet
is :
000000000032df70 T _ZN7KWallet6Wallet10openWalletERK7QStringmNS0_8OpenTypeE
As you can see there is that funcion in libkdeui.so file. ^^
I have installed libraries with:
sudo apt-get install kdelibs5-dev libkparts4
Can someone tell me what am I doing wrong? Where is the mistake?
SSCCE:
#include <QCoreApplication>
#include <KWallet/Wallet>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
using namespace KWallet;
Wallet* wallet = Wallet::openWallet(Wallet::LocalWallet(), 0);
return a.exec();
}
.pro
file:
QT += core
TARGET = untitled
TEMPLATE = app
SOURCES += main.cpp
LIBS += -lkdeui -lkdecore -lkparts
INCLUDEPATH += /usr/include/KDE \
/usr/include/KDE/KWallet
Compilation:
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_DBUS_LIB -DQT_CORE_LIB -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -I. -I/usr/include/KDE -I/usr/include/KDE/KWallet -ITDIR/include/QtGui -ITDIR/include -I. -o main.o main.cpp
g++ -m64 -Wl,-O1 -o untitled main.o -L/usr/lib -L/usr/X11R6/lib64 -lkdeui -lkdecore -lkparts -L/usr/lib/x86_64-linux-gnu -lGL -lpthread
#include <QtCore/QStringList>
->#include <QStringList>
etc. – user1824918KWallet
library installed? This will fail linking even though you've included them in theLIBS
directive. – Tyler Jandreau-lkdeui
as last command line parameter. Or at least try toLIBS += -lkdecore -lkparts -lkdeui
– triclosan