I am inexperience in Python and C programs.
(我对Python和C程序缺乏经验。)
My test script written in c/c++ needs to call a python function. (我用c / c ++编写的测试脚本需要调用python函数。)
I have searched online [ https://www.codeproject.com/Articles/11805/Embedding-Python-in-CC-Part-I] , then copied the "call_function.c" and "py_function.py" from the link into my Linux system. (我已经在线搜索[ https://www.codeproject.com/Articles/11805/Embedding-Python-in-CC-Part-I] ,然后将链接中的“ call_function.c”和“ py_function.py”复制到我的Linux系统。)
The Linux version is "3.13.0-65-generic" and was installed Python2.7. (Linux版本是“ 3.13.0-65-generic”,并已安装Python2.7。)
There was not error when compiling "call_function.c" with below command line.
(使用以下命令行编译“ call_function.c”时没有错误。)
[gcc call_function.c -o call_function -I/usr/include/python2.7 -L/usr/lib/python2.7/lib -lpython2.7] ([gcc call_function.c -o call_function -I / usr / include / python2.7 -L / usr / lib / python2.7 / lib -lpython2.7])
I then ran the "call_function" with below command.
(然后,我使用以下命令运行“ call_function”。)
[./call_function py_function.py multiply] ([./call_function py_function.py乘以])
The "Segmentation fault (core dumped)" popped up.
(弹出“分段故障(核心已转储)”。)
I do not have any clues on this error.
(我对此错误没有任何线索。)
Please enlighten me. (请赐教。)
ask by user10293779 translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…