I’ve literally spent the past half hour searching for the solution to this, and everything involves GCC. What I do here works absolutely fine with GCC, however I’m using TinyCC, and this is where I’m getting confused. First the code:
#include <Python.h> #include <stdio.h> int main(int argc, char*argv[]) { Py_Initialize(); PyRun_SimpleString('print(\'Hello World!\')'); Py_Finalize(); return 0; }
I then call tcc like so:
tcc -o tinypyembed.exe tiny.c -IC:\Python26\include -LC:\Python26\libs -lpython26
It then becomes a big fat jerk and spits out
tcc: undefined symbol 'Py_Initialize' tcc: undefined symbol 'PyRun_SimpleStringFlags' tcc: undefined symbol 'Py_Finalize'
I’m totally at my wits end and really do appreciate it if anyone knows what’s up.
After asking a friend to try this out I have discovered that it is in fact a windows issue. May this stay here as a warning to anyone else who may try tinycc with python on windows.
Did you use
tiny_impdef.exeto create a.deffile for the Python DLL?