title: Including Python.h in Qt application causes undefined reference to Qt functions
body: <p>I'd like to include <code>Python.h</code> (from the Python distribution in my Anaconda folder) in my project to call a python script. The program compiles fine when I don't include python. But as soon as I do, I get <code>undefined reference</code> errors to functions implemented in Qt classes (so not my own functions!). The python version I'd like to include is <code>3.5.5</code>.</p>
  
  <p>The part that confuses me most is <code>undefined reference to QJsonValue::toString()</code>. This method is implemented inline so how can its implementation not be found? According to QtCreator the problem originates in a compiled object that tries to call this function.</p>
  
  <p>This is a minimally (not) working example:</p>
  
  <p>The .pro file:</p>
  
  <pre><code>QT -= gui
  CONFIG += c++11 console no_keywords
  SOURCES += main.cpp
  INCLUDEPATH += {path to python include}
  LIBS += -L{path to python lib} -lpython3.5m
  </code></pre>
  
  <p>And the main.cpp file:</p>
  
  <pre><code>#include &lt;Python.h&gt;
  #include &lt;QCoreApplication&gt;
  #include &lt;QJsonValue&gt;
  
  int main(int argc, char *argv[])
  {
      QCoreApplication a(argc, argv);
      PyObject *obj;
      QJsonValue value;
      value.toString();
      return a.exec();
  }
  </code></pre>
  
  <p><em>Update:</em> It seems like including Python from Anaconda is causing the issue. When I remove <code>LIBS += -L{path to python lib} -lpython3.5m</code> it compiles just fine. And when I remove <code>INCLUDEPATH += {path to python include}</code> but keep the other line I get the following error:</p>
  
  <pre><code>/{user}/build-TestProject-Qt_5_9-Debug/TestProject: /{user}/anaconda3/lib/libQt5Core.so.5: version `Qt_5.9' not found (required by /{user}/build-TestProject-Qt_5_9-Debug/TestProject)
  </code></pre>