'Mac - include Python.h framework when compiling a cpp file

I'm currently building a cpp project which contains python code. To use embed python code in c++ the Python.h file from the Python.framework is required.

Before apple changed something the python framework was in system/library/frameworks after their changes it is now in just library/frameworks.

Idea 1:

In Vscode I could add the 2nd argument ("/Library/Frameworks") to the c_cpp_properties.json file. This turned off intellisense but didn't help with the compiler error.

"macFrameworkPath": [ 
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks", 
"/Library/Frameworks" 
]

The idea was to pass the path as argument to the compiler (clang++). But I couldn't find a way. I've read something about -I, but didn't understand it.

Idea 2:

My 2nd Idea was to just add the framework or the Library/Frameworks path somehow to the path to make it accessible. Such as that the Library/Frameworks folder is also seem as a frameworks folder and I can just include it in my c++ script.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source