I have an error trying to link python into my C++ code.
This is the error line I am getting:
C:\Python27\libs/libpython27.a(dmmes00855.o):(.idata$7+0x0): undefined reference to `_head_C__build27_cpython_PCBuild_libpython27_a'
collect2.exe: error: ld returned 1 exit status
For background, here is minimal case:
#include <Python.h>
int main()
{
Py_Initialize();
}
I am using scons to build:
import os
env = Environment(ENV = os.environ)
env.Append(CPPPATH = "C:/Python27/include/")
env.Append(LIBPATH = "C:/Python27/libs/")
env.Append(LIBS = "python27")
env.Program("test", "test.cpp")
It generates the following commands:
g++ -o test.o -c -IC:\Python27\include test.cpp
g++ -o test.exe test.o -LC:\Python27\libs -lpython27
Compiler is the mingw that I have as part of my Qt download.