473,238 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,238 software developers and data experts.

Python extension on Windows

hi all,
i'm new to python and i'm trying to build a python extension on win98,
written in c++, with cygwin.
but i keep having the same error message, and i didnt't find much
resources on the web about it:
g++ -I/cygdrive/c/python22/include -c demomodule.cpp -o demomodule.o


In file included from /cygdrive/c/python22/include/Python.h:62,
from demomodule.cpp:1:
/cygdrive/c/python22/include/pyport.h:480:2: #error "LONG_BIT definition
appears wrong for platform (bad gcc/glibc config?)."

i read that it is mandatory to use Micro$oft visual c++ to build any
extensions on windows beacuse it's the same compiler used to build
python for windows.
does anybody has advices about that?
i would rather use cygwin/g++ but i don't know if it's possible or how
to fix this error message.
thanks in advance,
David.

Jul 18 '05 #1
3 4484
David Isal wrote:
hi all,
i'm new to python and i'm trying to build a python extension on win98,
written in c++, with cygwin.^
So we're talking native win32 here, right? You *can* use the Cygwin
toolset to compile native win32 executables and DLLs, but I prefer to
use MINGW for this.
but i keep having the same error message, and i didnt't find much
resources on the web about it:
>g++ -I/cygdrive/c/python22/include -c demomodule.cpp -o demomodule.o
In file included from /cygdrive/c/python22/include/Python.h:62,
from demomodule.cpp:1:
/cygdrive/c/python22/include/pyport.h:480:2: #error "LONG_BIT definition
appears wrong for platform (bad gcc/glibc config?)."


Yep. Use MINGW, the native GCC for win32. That's what I use and where I
could help you with.

If you want to continue using Cygwin to build extension modules, be sure
to have the win32api Cygwin package installed.
i read that it is mandatory to use Micro$oft visual c++ to build any
extensions on windows beacuse it's the same compiler used to build
python for windows.
That's wrong. See
http://www.python.org/doc/current/in...compilers.html
does anybody has advices about that?


Yes, read the above page :-)

I also recommend to use distutils to compile Python extensions instead
of trying to find out the correct compiler and linker options yourself.
It's the easiest way to compile Python extensions, no matter what the
platform.

See http://aspn.activestate.com/ASPN/Coo...n/Recipe/66509 for a
recipe.

Build it using mingw or Cygwin with this command:

c:/python22/python setup.py build --compiler=mingw32

I'd recommend you try a minimal C extension first before using C++. IIRC
I needed to use something like libraries=["stdc++"] for making a C++
extension with distutils.

-- Gerhard

Jul 18 '05 #2
David Isal <da********@wanadoo.fr> wrote in message news:<be**********@news-reader4.wanadoo.fr>...
i read that it is mandatory to use Micro$oft visual c++ to build any
extensions on windows beacuse it's the same compiler used to build
python for windows.
does anybody has advices about that?
i would rather use cygwin/g++ but i don't know if it's possible or how
to fix this error message.


I don't know what's causing your particular problem (since I got free
MSVC++ from a Microsoft promotional gimmick), but if you download the
python 2.2.3 source and compile that with Cygwin, that should
eliminate any possible incompatibilities between compilers.

The source tarball is at
<http://python.org/ftp/python/2.2.3/Python-2.2.3.tgz>.
Jul 18 '05 #3
thank you guys for your advices ;-)
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: BOOGIEMAN | last post by:
Well that's it, how do I make Windows Application with Python ??? Is there simple way that works 100% ? How can I rework visual design done in VS 2003 to use it for my python program ?
3
by: Matthias Baas | last post by:
Hi, are there any guidelines about what to do if a Windows extension for Python 2.4 requires the C++ runtime (msvcp71.dll)? If I want to distribute a binary installer of an extension that...
10
by: Andrew Dalke | last post by:
Is there an author index for the new version of the Python cookbook? As a contributor I got my comp version delivered today and my ego wanted some gratification. I couldn't find my entries. ...
48
by: meyer | last post by:
Hi everyone, which compiler will Python 2.5 on Windows (Intel) be built with? I notice that Python 2.4 apparently has been built with the VS2003 toolkit compiler, and I read a post from Scott...
6
by: JW | last post by:
I have a lousy little Python extension, generated with the generous help of Pyrex. In Linux, things are simple. I compile the extension, link it against some C stuff, and *poof*! everything...
32
by: siggi | last post by:
@Ben Sizer Hi Ben, in January I received your message re Pygame and Python 2.5: As a Python (and programming ) newbie allow me a - certainly naive - question:
15
by: kyosohma | last post by:
Hi, I am trying to get a small group of volunteers together to create Windows binaries for any Python extension developer that needs them, much like the package/extension builders who volunteer...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.