c++ - CPP calling Python, undefined references (Raspberry Pi) -
i trying call python script cpp script using below programs, cpp script not compile saying there undefined reference py_initialize
, pyrun_simplestring
.
what need fix makefile?
(cpp 11, python 2.7)
cpp:
#include <string> #include <stdio.h> #include <fstream> #include <unistd.h> #include <python.h> using namespace std; int main() { py_initialize(); while(1) { pyrun_simplestring("print 'a'"); usleep(1000); } py_finalize(); return 0; }
my makefile is:
all: myserver myserver: myserver.o g++ myserver.o -o myserver myserver.o: myserver.cpp g++ -c myserver.cpp -std=c++11 -i/usr/include/python2.7 -lpython2.7 -l/usr/lib/python2.7/config/ clean: rm -rf *o myserver
this seemed work, not solution though:
all: myserver myserver: g++ myserver.cpp -std=c++11 -i/usr/include/python2.7 -lpython2.7 -l/usr/lib/python2.7/config/ -o myserver clean: rm -rf *o myserver
Comments
Post a Comment