jjzjj

c++ - g++ 中未定义的 Python 引用

coder 2024-02-04 原文

我正在使用以下命令:

g++ -L/usr/lib/panda3d -L/usr/lib -o "panda3dplayground"  ./main.o   -lpython2.7 -lp3pystub -lp3framework -lpandafx -lp3pystub -lpandaexpress -lpanda -lp3framework -lp3direct

我收到以下错误:

/usr/lib/panda3d/libpanda.so: undefined reference to `PyObject_Cmp'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyUnicodeUCS4_FromWideChar'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyDict_SetItem'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyExc_ValueError'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyDict_SetItemString'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyType_IsSubtype'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyString_FromString'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyErr_Fetch'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyExc_StandardError'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyInt_AsSsize_t'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyArg_Parse'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyEval_RestoreThread'
/usr/lib/panda3d/libpandaexpress.so: undefined reference to `PyString_AsStringAndSize'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyObject_CallFunction'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyDict_Size'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyString_Size'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyErr_Print'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyErr_SetString'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyGILState_Ensure'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyObject_CallObject'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyString_FromStringAndSize'
/usr/lib/panda3d/libp3dtool.so: undefined reference to `PySys_GetObject'
/usr/lib/panda3d/libp3dtool.so: undefined reference to `PyList_GetItem'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyExc_AssertionError'
/usr/lib/panda3d/libp3dtoolconfig.so: undefined reference to `Py_InitModule4_64'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyModule_AddStringConstant'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyGen_Type'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyObject_Compare'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyList_Append'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyMapping_GetItemString'
/usr/lib/panda3d/libp3dtoolconfig.so: undefined reference to `PyArg_ParseTuple'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyTuple_Pack'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyLong_FromUnsignedLongLong'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyObject_Repr'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyInt_FromLong'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyArg_ParseTupleAndKeywords'
/usr/lib/panda3d/libpanda.so: undefined reference to `_Py_NoneStruct'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyList_SetItem'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyCallable_Check'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyErr_Clear'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyLong_AsUnsignedLongLong'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyErr_ExceptionMatches'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyDict_New'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyUnicodeUCS4_AsWideChar'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyInt_AsLong'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyUnicodeUCS4_GetSize'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyObject_RichCompareBool'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyModule_AddObject'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyGILState_Release'
/usr/lib/panda3d/libpanda.so: undefined reference to `PySequence_GetItem'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyLong_AsUnsignedLong'
/usr/lib/panda3d/libpanda.so: undefined reference to `_Py_NotImplementedStruct'
/usr/lib/panda3d/libpanda.so: undefined reference to `PySequence_Size'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyExc_TypeError'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyNumber_Long'
/usr/lib/panda3d/libpanda.so: undefined reference to `Py_BuildValue'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyEval_InitThreads'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyType_Ready'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyFloat_FromDouble'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyObject_GenericSetAttr'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyObject_IsTrue'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyImport_GetModuleDict'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyObject_Free'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyNumber_Float'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyBool_FromLong'
/usr/lib/panda3d/libp3dtoolconfig.so: undefined reference to `PyLong_AsLong'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyExc_IndexError'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyLong_AsLongLong'
/usr/lib/panda3d/libpandaexpress.so: undefined reference to `PyLong_FromLongLong'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyFloat_AsDouble'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyEval_SaveThread'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyErr_Restore'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyErr_WarnEx'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyString_Type'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyExc_StopIteration'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyObject_Type'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyObject_Call'
/usr/lib/panda3d/libpanda.so: undefined reference to `PySequence_Check'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyType_GenericAlloc'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyString_AsString'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyModule_AddIntConstant'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyObject_CallMethod'
/usr/lib/panda3d/libp3dtool.so: undefined reference to `Py_IsInitialized'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyObject_GetAttrString'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyList_New'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyExc_SystemExit'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyDict_GetItem'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyExc_FutureWarning'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyTuple_New'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyErr_Format'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyCFunction_NewEx'
/usr/lib/panda3d/libp3dtoolconfig.so: undefined reference to `PyLong_FromUnsignedLong'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyExc_AttributeError'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyObject_GenericGetAttr'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyTuple_Size'
/usr/lib/panda3d/libpanda.so: undefined reference to `PySequence_Fast'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyErr_Occurred'
/usr/lib/panda3d/libpanda.so: undefined reference to `PySequence_Tuple'
/usr/lib/panda3d/libpanda.so: undefined reference to `PyDict_DelItemString'
collect2: error: ld returned 1 exit status

为什么 g++ 不能识别 libpython2.7.so?我检查了一下,它位于 /usr/lib 中。

最佳答案

链接线上库的顺序matters ,您的订单有误。

关于c++ - g++ 中未定义的 Python 引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16382075/

有关c++ - g++ 中未定义的 Python 引用的更多相关文章

  1. ruby - Facter::Util::Uptime:Module 的未定义方法 get_uptime (NoMethodError) - 2

    我正在尝试设置一个puppet节点,但ruby​​gems似乎不正常。如果我通过它自己的二进制文件(/usr/lib/ruby/gems/1.8/gems/facter-1.5.8/bin/facter)在cli上运行facter,它工作正常,但如果我通过由ruby​​gems(/usr/bin/facter)安装的二进制文件,它抛出:/usr/lib/ruby/1.8/facter/uptime.rb:11:undefinedmethod`get_uptime'forFacter::Util::Uptime:Module(NoMethodError)from/usr/lib/ruby

  2. python - 如何使用 Ruby 或 Python 创建一系列高音调和低音调的蜂鸣声? - 2

    关闭。这个问题是opinion-based.它目前不接受答案。想要改进这个问题?更新问题,以便editingthispost可以用事实和引用来回答它.关闭4年前。Improvethisquestion我想在固定时间创建一系列低音和高音调的哔哔声。例如:在150毫秒时发出高音调的蜂鸣声在151毫秒时发出低音调的蜂鸣声200毫秒时发出低音调的蜂鸣声250毫秒的高音调蜂鸣声有没有办法在Ruby或Python中做到这一点?我真的不在乎输出编码是什么(.wav、.mp3、.ogg等等),但我确实想创建一个输出文件。

  3. ruby-on-rails - Rails 3.2.1 中 ActionMailer 中的未定义方法 'default_content_type=' - 2

    我在我的项目中添加了一个系统来重置用户密码并通过电子邮件将密码发送给他,以防他忘记密码。昨天它运行良好(当我实现它时)。当我今天尝试启动服务器时,出现以下错误。=>BootingWEBrick=>Rails3.2.1applicationstartingindevelopmentonhttp://0.0.0.0:3000=>Callwith-dtodetach=>Ctrl-CtoshutdownserverExiting/Users/vinayshenoy/.rvm/gems/ruby-1.9.3-p0/gems/actionmailer-3.2.1/lib/action_mailer

  4. ruby-on-rails - 如何优雅地重启 thin + nginx? - 2

    我的瘦服务器配置了nginx,我的ROR应用程序正在它们上运行。在我发布代码更新时运行thinrestart会给我的应用程序带来一些停机时间。我试图弄清楚如何优雅地重启正在运行的Thin实例,但找不到好的解决方案。有没有人能做到这一点? 最佳答案 #Restartjustthethinserverdescribedbythatconfigsudothin-C/etc/thin/mysite.ymlrestartNginx将继续运行并代理请求。如果您将Nginx设置为使用多个上游服务器,例如server{listen80;server

  5. ruby-on-rails - form_for 中不在模型中的自定义字段 - 2

    我想向我的Controller传递一个参数,它是一个简单的复选框,但我不知道如何在模型的form_for中引入它,这是我的观点:{:id=>'go_finance'}do|f|%>Transferirde:para:Entrada:"input",:placeholder=>"Quantofoiganho?"%>Saída:"output",:placeholder=>"Quantofoigasto?"%>Nota:我想做一个额外的复选框,但我该怎么做,模型中没有一个对象,而是一个要检查的对象,以便在Controller中创建一个ifelse,如果没有检查,请帮助我,非常感谢,谢谢

  6. ruby - 主要 :Object when running build from sublime 的未定义方法 `require_relative' - 2

    我已经从我的命令行中获得了一切,所以我可以运行rubymyfile并且它可以正常工作。但是当我尝试从sublime中运行它时,我得到了undefinedmethod`require_relative'formain:Object有人知道我的sublime设置中缺少什么吗?我正在使用OSX并安装了rvm。 最佳答案 或者,您可以只使用“require”,它应该可以正常工作。我认为“require_relative”仅适用于ruby​​1.9+ 关于ruby-主要:Objectwhenrun

  7. ruby - 在 Ruby 中有条件地定义函数 - 2

    我有一些代码在几个不同的位置之一运行:作为具有调试输出的命令行工具,作为不接受任何输出的更大程序的一部分,以及在Rails环境中。有时我需要根据代码的位置对代码进行细微的更改,我意识到以下样式似乎可行:print"Testingnestedfunctionsdefined\n"CLI=trueifCLIdeftest_printprint"CommandLineVersion\n"endelsedeftest_printprint"ReleaseVersion\n"endendtest_print()这导致:TestingnestedfunctionsdefinedCommandLin

  8. ruby - 定义方法参数的条件 - 2

    我有一个只接受一个参数的方法:defmy_method(number)end如果使用number调用方法,我该如何引发错误??通常,我如何定义方法参数的条件?比如我想在调用的时候报错:my_method(1) 最佳答案 您可以添加guard在函数的开头,如果参数无效则引发异常。例如:defmy_method(number)failArgumentError,"Inputshouldbegreaterthanorequalto2"ifnumbereputse.messageend#=>Inputshouldbegreaterthano

  9. ruby - 如何在 Grape 中定义哈希数组? - 2

    我使用Ember作为我的前端和GrapeAPI来为我的API提供服务。前端发送类似:{"service"=>{"name"=>"Name","duration"=>"30","user"=>nil,"organization"=>"org","category"=>nil,"description"=>"description","disabled"=>true,"color"=>nil,"availabilities"=>[{"day"=>"Saturday","enabled"=>false,"timeSlots"=>[{"startAt"=>"09:00AM","endAt"=>

  10. ruby - 获取模块中定义的所有常量的值 - 2

    我想获取模块中定义的所有常量的值:moduleLettersA='apple'.freezeB='boy'.freezeendconstants给了我常量的名字:Letters.constants(false)#=>[:A,:B]如何获取它们的值的数组,即["apple","boy"]? 最佳答案 为了做到这一点,请使用mapLetters.constants(false).map&Letters.method(:const_get)这将返回["a","b"]第二种方式:Letters.constants(false).map{|c

随机推荐