Python Forum
Is there a problem with LONG_BIT in pyconfig.h ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is there a problem with LONG_BIT in pyconfig.h ?
#1
Hi,

I am trying to make some code that I wrote in C++ available to me in Python. To do this, I am trying out pybind11. But I am running into a compile error. I know there are other ways, but this seemed an elegant solution that I'm not quite ready to give up on.

The way this works is, in my C++ code, I need to include headers from pybind11, and Python.h from my python installation. I'm using 64-bit compilation of C++ (cygwin64), and I have downloaded a recent 64-bit version of python to my machine (https://www.python.org/ftp/python/3.6.4/...-amd64.exe). It's a self-install.

The problem I'm running into is that when I compile my C++ code with "#include <Python.h>" I get the following error from pyport.h.

error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?).

I can see that LONG_BIT is defined in pyconfig.h: "#define LONG_BIT 32"

But is that correct? I'm not familiar with the code, but my intuition would be that for a 64-bit version of python, LONG_BIT should be 64. Just for kicks, I tried to make this simple change to 64, but this led to more compile errors.

Is anyone familiar with this? Can anyone give me some guidance? Much appreciated.

Dave
Reply


Messages In This Thread
Is there a problem with LONG_BIT in pyconfig.h ? - by DavidH - Mar-04-2018, 06:25 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020