我想在C++程序中使用python代码。我的IDE是Mac Eclipse C++。你知道吗
我有一份cpp文件测试.cpp导入.py文件。你知道吗
你知道吗测试.cpp有#include <Python.h>
。你知道吗
我将Python 2.7文件夹包含在GCC C++编译器中,包括路径。你知道吗
就像:
g++ -
I/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/include/python2.7...
但是cpp没有运行。C++链接器看起来很幼稚。你知道吗
我能做什么?你知道吗
完整控制台信息是:
make all
Building file: ../src/CppTest.cpp
Invoking: GCC C++ Compiler
g++ -I/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/include/python2.7 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/CppTest.d" -MT"src/CppTest.o" -o "src/CppTest.o" "../src/CppTest.cpp"
Finished building: ../src/CppTest.cpp
Building target: CppTest
Invoking: MacOS X C++ Linker
g++ -o "CppTest" ./src/CppTest.o
Undefined symbols for architecture x86_64:
"_PyImport_Import", referenced from:
great_function_from_python(int) in CppTest.o
"_PyInt_AsLong", referenced from:
great_function_from_python(int) in CppTest.o
"_PyInt_FromLong", referenced from:
great_function_from_python(int) in CppTest.o
"_PyObject_CallObject", referenced from:
great_function_from_python(int) in CppTest.o
"_PyObject_GetAttrString", referenced from:
great_function_from_python(int) in CppTest.o
"_PyString_FromString", referenced from:
great_function_from_python(int) in CppTest.o
"_PyTuple_New", referenced from:
great_function_from_python(int) in CppTest.o
"_PyTuple_SetItem", referenced from:
great_function_from_python(int) in CppTest.o
"_Py_Finalize", referenced from:
_main in CppTest.o
"_Py_Initialize", referenced from:
_main in CppTest.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [CppTest] Error 1
16:37:09 Build Finished (took 558ms)
目前没有回答
相关问题 更多 >
编程相关推荐