Download

ld: symbol(s) not found for architecture x86_64 while embedding python

Hey everyone,

So I am trying to embedded some python script within my C++ class. To give a bit of background, the part of the project that I am working on could be cut from the main UE4 project which let me code without the needs of having UE4 on the background. I already have a C++ project that I can use to run my python script on my computer and thus I am now trying to mimic this script into UE4. Which is also why I post my question on the C++ forum as I feel this is more likely an issue from the C++ part.

I have seen that there’s some embedding python possibilities directly within UE4 but it feels that this is not what I want to do here, as I want to implement the python script directly within my C++ class. In that case, I am looking for any help of how to do this. So far it seems that UE4 sees the Python.h library (#include “Python.h” compiled) but then, when trying to initialise python, I got a compilation error:

CompilerResultsLog: Undefined symbols for architecture x86_64:
CompilerResultsLog: “_Py_Initialize”, referenced from:
CompilerResultsLog: AMyTestCharacter::BeginPlay() in MyTestCharacter.cpp.o
CompilerResultsLog: ld: symbol(s) not found for architecture x86_64

As I already had these kind of issue from my C++ project, which resulted by modifying the CMakeLists.txt, I tried to edit the CMakeLists.txt file (even though it is clearly written DO NOT EDIT) as to add the lines that was required in my C++ project but it failed.

Any help welcomed