1
votes

Undefined symbols for architecture i386:

"_PyInt_AsLong", referenced from: _main in main.o

"_PyInt_FromLong", referenced from: _main in main.o

"_PyString_FromString", referenced from: _main in main.o

ld: symbol(s) not found for architecture i386 clang: error:

linker command failed with exit code 1 (use -v to see invocation)

1
Wild guess, you are trying to compile Python 2 code with Python 3. Reason for wild guess = _PyInt_FromLong is replaced with PyLong_FromLong. See python3porting.com/cextensions.html - cdarke

1 Answers

1
votes

Replacing

  1. PyUnicode_AsUTF8 or PyUnicode_FromString for _PyString_FromString
  2. PyLong_AsLong for _PyInt_AsLong
  3. PyLong_FromLong for _PyInt_FromLong

solved my problem.