Including Python.h in Qt application causes undefined reference to Qt functions

喜你入骨 提交于 2019-12-05 19:44:28

The issue was caused by using Anaconda's Python distribution. Setting the project to include Python causes QtCreator to use Anaconda's qmake instead of the installed version. If you can live with Qt 5.6, which is the current version of Qt in Anaconda, create a Kit with Anaconda's qmake and the program compiles again.

If you need a newer version of Qt you can add the line

-L/{user}/Qt5.9.5/5.9.5/gcc_64/lib -lQt5Core

to your .pro file. Adjust it to your Qt version and what libraries you need. This is not exactly a pretty solution, as you need to adjust the .pro file whenever you want to switch versions, but it's the only solution I know of.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!