Undefined reference - despite lib being found by linker

后端 未结 4 1983
我在风中等你
我在风中等你 2020-12-28 20:32

I have a trivial program to test for availability of python development files:

#include
int main(){Py_Initialize(); Py_Finalize(); }
<         


        
4条回答
  •  礼貌的吻别
    2020-12-28 20:45

    if with python 3.x installed, maybe this command can work:

    g++ hw.cpp `/usr/bin/python3-config --cflags` `/usr/python3-config --ldflags`
    

    By the way, you should check you gcc and python version.

    As I know, if gcc version is 5.4 and python version is 3.7, it doesn't work.(python 3.5 is work)

    When you run /usr/bin/python3-config --cflags, in fact, it is the compile option.

提交回复
热议问题