Link Errors Trying to Embed Python in C
Jeff Perry
jsp at mail.utexas.edu
Thu Sep 28 13:23:04 EDT 2000
I am trying to embed Python in a C application, but I keep getting link
errors. I am running Windows 98, and I am using Python 1.6. The errors I
get are of the nature:
config.c: undefined reference to 'init***'
I compile with config.c and I link with python16.lib. Obviously, I'm not
linking with the right stuff-- can someone tell me what I'm missing?
BTW, when I try the same thing under Linux 2.2.16-3 linking with config.c
and libpython1.6.a, I get almost identical results.
My C file looks like this:
pyrun.c
****
#include "Python.h"
int main (int argc, char **argv) { Py_Initialize (); return 0 }
****
My Makefile looks like this:
Makefile
****
PYLIB=python16.lib
LIB=c:/progra~1/python16/libs/$(PYLIB)
PYSRC=c:/progra~1/python16/PC/
INCLUDE=c:/progra~1/python16/include
CC=gcc -Wall -I$(INCLUDE) $(OPT)
CFILES=pyrun.c
all:
$(CC) $(LIB) $(CFILES) $(PYSRC)/config.c
****
Thanks,
Jeff
More information about the Python-list
mailing list