title: Linking error: undefined reference
body: <p>My compiler reports this undefined reference to <code>openWallet(..)</code> function.  As you can see I have linked responding libraries <code>-L/usr/lib -lkdeui -kdecore -lkparts</code>. </p>
  
  <p>Error:</p>
  
  <pre><code>password.cpp:(.text+0x29): undefined reference to `KWallet::Wallet::openWallet(QString const&amp;, unsigned long long, KWallet::Wallet::OpenType)'
  </code></pre>
  
  <p>Compile command:</p>
  
  <blockquote>
    <p>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</p>
  </blockquote>
  
  <p>Same error is reported by QtCreator. <code>.pro</code> file contains</p>
  
  <pre><code>LIBS += -lkdecore \
          -lkdeui \
          -lkparts
  </code></pre>
  
  <p>I have all that required libs installed. Proof:</p>
  
  <p>Output of <code>nm -D /usr/lib/libkdeui.so | grep openWallet</code> is :</p>
  
  <blockquote>
    <p>000000000032df70 T
    _ZN7KWallet6Wallet10openWalletERK7QStringmNS0_8OpenTypeE</p>
  </blockquote>
  
  <p>As you can see there is that funcion in libkdeui.so file. ^^</p>
  
  <p>I have installed libraries with:</p>
  
  <pre><code>sudo apt-get install kdelibs5-dev libkparts4
  </code></pre>
  
  <p>Can someone tell me what am I doing wrong? Where is the mistake?</p>
  
  <p>SSCCE:</p>
  
  <pre><code>#include &lt;QCoreApplication&gt;
  #include &lt;KWallet/Wallet&gt;
  
  int main(int argc, char *argv[])
  {
      QCoreApplication a(argc, argv);
      using namespace KWallet;
  
      Wallet* wallet = Wallet::openWallet(Wallet::LocalWallet(), 0);
      return a.exec();
  }
  </code></pre>
  
  <p><code>.pro</code> file:</p>
  
  <pre><code>QT       += core 
  
  TARGET = untitled
  
  TEMPLATE = app
  
  SOURCES += main.cpp
  
  LIBS += -lkdeui -lkdecore -lkparts
  
  INCLUDEPATH += /usr/include/KDE \
                 /usr/include/KDE/KWallet
  </code></pre>
  
  <p>Compilation:</p>
  
  <blockquote>
    <p>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   </p>
    
    <p>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</p>
  </blockquote>