pythonqt icon indicating copy to clipboard operation
pythonqt copied to clipboard

Compile Failed in macOS using QtCreator

Open sniperXue opened this issue 4 years ago • 1 comments

I add the path of Python.h in PythonQt.pro

INCLUDEPATH += /Users/../anaconda3/include/python3.7m

but I still have three problems . What code I need to add to fix these problems for compile?

PythonQtConversion.o:-1: error: Undefined symbols for architecture x86_64:
  "_PyBytes_FromStringAndSize", referenced from:
      PythonQtInstanceWrapper_str(_object*) in PythonQtInstanceWrapper.o
      PythonQtWrapper_QByteArray::data(QByteArray*) in moc_com_trolltech_qt_core_builtin0.o
  "_PyBytes_Type", referenced from:
      PythonQtConv::ConvertPythonToQt(PythonQtMethodInfo::ParameterInfo const&, _object*, bool, PythonQtClassInfo*, void*, PythonQtArgumentFrame*) in PythonQtConversion.o
      PythonQtConv::PyObjToStringList(_object*, bool, bool&) in PythonQtConversion.o
  "_PyImport_ExecCodeModuleObject", referenced from:
      PythonQtImporter_load_module(_object*, _object*) in PythonQtImporter.o
  "_PyMapping_Items", referenced from:
      bool PythonQtConvertPythonToIntegerMap<QMap<int, QByteArray>, QByteArray>(_object*, void*, int, bool) in PythonQt.o
      bool PythonQtConvertPythonToIntegerMap<QMap<int, QVariant>, QVariant>(_object*, void*, int, bool) in PythonQt.o
      bool PythonQtConvertPythonToIntegerMap<QMap<int, QString>, QString>(_object*, void*, int, bool) in PythonQt.o
      bool PythonQtConvertPythonToIntegerMap<QHash<int, QByteArray>, QByteArray>(_object*, void*, int, bool) in PythonQt.o
      bool PythonQtConvertPythonToIntegerMap<QHash<int, QVariant>, QVariant>(_object*, void*, int, bool) in PythonQt.o
      bool PythonQtConvertPythonToIntegerMap<QHash<int, QString>, QString>(_object*, void*, int, bool) in PythonQt.o
      void PythonQtConv::pythonToMapVariant<QMap<QString, QVariant> >(_object*, QVariant&) in PythonQtConversion.o

:-1: error: symbol(s) not found for architecture x86_64 :-1: error: linker command failed with exit code 1 (use -v to see invocation)

sniperXue avatar Sep 24 '20 08:09 sniperXue

It seems you are not linking to the Python library. As you already set INCLUDEPATH to your Python distribution, you probably need to set LIBS, too.

usiems avatar Dec 03 '20 14:12 usiems

Closing as answered, fell free to reopen if there are still issues.

mrbean-bremen avatar Dec 15 '23 14:12 mrbean-bremen