1

I am trying to embed python 3.7.0 in a C++ application and use MinGW to compile.

#include "Dependencies/include/Python.h"


int main()
{

    PyObject* myPointer;
    Py_Initialize();
    return 0;
}

I compile with this:

g++ ./TestEmbedding.cpp

I get this error:

undefined reference to `_imp__Py_Initialize'

2 Answers 2

1

EDIT: Found and Answer:

The path to the python libs file needs to be included. I personally am now using Visual Studio and just included it in the settings but I think MinGW can do it with some command line adjustments.

include something similar to this in library paths. C:Local\Programs\Python\Python37\Lib

Sign up to request clarification or add additional context in comments.

1 Comment

There is no python folder in my local folder.
0

You need to build with Python headers:

g++ TestEmbedding.cpp `python3-config --includes` -o TestEmbedding

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.