/* * ===================================================================================== * * Filename: cppPython.cpp * * Description: * * Version: 1.0 * Created: 09/26/2017 05:01:58 PM * Last Modified: 2018-01-08 08:19:21 * Revision: none * Compiler: gcc * * Author: zt (), * Organization: * * ===================================================================================== */ #include #include #include #include //g++ cppPython.cpp -o a -lpython2.7 void HelloWorld() { Py_Initialize(); PyObject* pModule = NULL; PyObject* pFunc = NULL; pModule = PyImport_ImportModule ( "test" ); if ( pModule ) pFunc = PyObject_GetAttrString ( pModule, "hello" ); else std::cout