Calling Python from C++, how to get rid of the `-Wstrict-prototypes` warning? -
Calling Python from C++, how to get rid of the `-Wstrict-prototypes` warning? -
i trying phone call python function c++. wrote simple main.cpp file , and helloworld.py following:
main.cpp:
int main(int argc, char* argv[]) { py_initialize(); pyrun_simplestring("import sys"); pyrun_simplestring("sys.path.append('./')"); pyobject *pmodule = pyimport_importmodule( "helloworld" ); pyobject *pfunc = pyobject_getattrstring(pmodule, "say_hello_world"); pyeval_callobject(pfunc, null); py_initialize(); }
helloworld.py:
def say_hello_world(): print( "hello world python" )
i compile programme with:
g++ `python-config --cflags` main.cpp `python-config --ldflags` -o main
and result, works fine except next warning:
cc1plus: warning: command line alternative ‘-wstrict-prototypes’ valid c/objc not c++ [enabled default]
what's cause of this? there way rid of it?
write script gccflags-filter
filter out flags inappropriate given language. example
python-config --cflags | gccflags-filter --lang=c++
the list of flags can taken documentation.
if need stopgap measure particular problem now, consider like
g++ `python-config --cflags | sed s/-wstrict-prototypes//`
python c++ gcc gcc-warning
Comments
Post a Comment