473,545 Members | 1,650 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trouble including Python.h

Hi, everyone.

This is on WinXP SP2, with Python 2.4.3 and DJGPP gcc 4.1.0.

I'm having trouble including Python.h in a C file. The following C
code:

#include "Python.h"

int main()
{
return 0;
}

when compiled with "gcc -I..\Python2.4\i nclude\", gives more than 1000
lines of errors, beginning with:

c:/documents and settings/marcelo.gosling/my
documents/djgpp/bin/as.exe: BFD 2.16.1 assertion fail
.../../bfd/coff-i386.c:576
c:/documents and settings/marcelo.gosling/my
documents/djgpp/tmp/ccACtxBR.s: Assembler messages:
c:/documents and settings/marcelo.gosling/my
documents/djgpp/tmp/ccACtxBR.s:28: Error: cannot represent relocation
type BFD_RELOC_386_P LT32
In file included from ../../Python2.4/include/Python.h:74,
from example_wrap.c: 112:
.../../Python2.4/include/pymem.h: In function '__declspec':
.../../Python2.4/include/pymem.h:51: error: expected declaration
specifiers before '__declspec'
.../../Python2.4/include/pymem.h:52: error: expected declaration
specifiers before '__declspec'
In file included from ../../Python2.4/include/Python.h:76,
from example_wrap.c: 112:
.../../Python2.4/include/object.h:104: error: storage class specified
for parameter 'PyObject'
.../../Python2.4/include/object.h:108: error: storage class specified
for parameter 'PyVarObject'
.../../Python2.4/include/object.h:126: error: expected '=', ',', ';',
'asm' or '__attribute__' before '*' token
.../../Python2.4/include/object.h:127: error: expected '=', ',', ';',
'asm' or '__attribute__' before '*' token
.../../Python2.4/include/object.h:128: error: expected '=', ',', ';',
'asm' or '__attribute__' before '*' token
.../../Python2.4/include/object.h:129: error: expected ')' before '*'
token
.../../Python2.4/include/object.h:130: error: expected ')' before '*'
token

Am I missing something important here?

Thanks in advance,

Marcelo

Jun 23 '06 #1
5 1981
Try

#undef _DEBUG
#include "C:\Python24\in clude\python.h"

or which ever path your python.h is located at

works for me

Marcelo Gosling wrote:
Hi, everyone.

This is on WinXP SP2, with Python 2.4.3 and DJGPP gcc 4.1.0.

I'm having trouble including Python.h in a C file. The following C
code:

#include "Python.h"

int main()
{
return 0;
}

when compiled with "gcc -I..\Python2.4\i nclude\", gives more than 1000
lines of errors, beginning with:

c:/documents and settings/marcelo.gosling/my
documents/djgpp/bin/as.exe: BFD 2.16.1 assertion fail
../../bfd/coff-i386.c:576
c:/documents and settings/marcelo.gosling/my
documents/djgpp/tmp/ccACtxBR.s: Assembler messages:
c:/documents and settings/marcelo.gosling/my
documents/djgpp/tmp/ccACtxBR.s:28: Error: cannot represent relocation
type BFD_RELOC_386_P LT32
In file included from ../../Python2.4/include/Python.h:74,
from example_wrap.c: 112:
../../Python2.4/include/pymem.h: In function '__declspec':
../../Python2.4/include/pymem.h:51: error: expected declaration
specifiers before '__declspec'
../../Python2.4/include/pymem.h:52: error: expected declaration
specifiers before '__declspec'
In file included from ../../Python2.4/include/Python.h:76,
from example_wrap.c: 112:
../../Python2.4/include/object.h:104: error: storage class specified
for parameter 'PyObject'
../../Python2.4/include/object.h:108: error: storage class specified
for parameter 'PyVarObject'
../../Python2.4/include/object.h:126: error: expected '=', ',', ';',
'asm' or '__attribute__' before '*' token
../../Python2.4/include/object.h:127: error: expected '=', ',', ';',
'asm' or '__attribute__' before '*' token
../../Python2.4/include/object.h:128: error: expected '=', ',', ';',
'asm' or '__attribute__' before '*' token
../../Python2.4/include/object.h:129: error: expected ')' before '*'
token
../../Python2.4/include/object.h:130: error: expected ')' before '*'
token

Am I missing something important here?

Thanks in advance,

Marcelo


Jun 23 '06 #2
No, that didn't do the trick. The main reason I'm posting this here is
that I get all tese error messages just from including Python.h, the
code itself does absolutely nothing.

Cheers

vduber6er wrote:
Try

#undef _DEBUG
#include "C:\Python24\in clude\python.h"

or which ever path your python.h is located at

works for me

Marcelo Gosling wrote:
Hi, everyone.

This is on WinXP SP2, with Python 2.4.3 and DJGPP gcc 4.1.0.

I'm having trouble including Python.h in a C file. The following C
code:

#include "Python.h"

int main()
{
return 0;
}

when compiled with "gcc -I..\Python2.4\i nclude\", gives more than 1000
lines of errors, beginning with:

c:/documents and settings/marcelo.gosling/my
documents/djgpp/bin/as.exe: BFD 2.16.1 assertion fail
../../bfd/coff-i386.c:576
c:/documents and settings/marcelo.gosling/my
documents/djgpp/tmp/ccACtxBR.s: Assembler messages:
c:/documents and settings/marcelo.gosling/my
documents/djgpp/tmp/ccACtxBR.s:28: Error: cannot represent relocation
type BFD_RELOC_386_P LT32
In file included from ../../Python2.4/include/Python.h:74,
from example_wrap.c: 112:
../../Python2.4/include/pymem.h: In function '__declspec':
../../Python2.4/include/pymem.h:51: error: expected declaration
specifiers before '__declspec'
../../Python2.4/include/pymem.h:52: error: expected declaration
specifiers before '__declspec'
In file included from ../../Python2.4/include/Python.h:76,
from example_wrap.c: 112:
../../Python2.4/include/object.h:104: error: storage class specified
for parameter 'PyObject'
../../Python2.4/include/object.h:108: error: storage class specified
for parameter 'PyVarObject'
../../Python2.4/include/object.h:126: error: expected '=', ',', ';',
'asm' or '__attribute__' before '*' token
../../Python2.4/include/object.h:127: error: expected '=', ',', ';',
'asm' or '__attribute__' before '*' token
../../Python2.4/include/object.h:128: error: expected '=', ',', ';',
'asm' or '__attribute__' before '*' token
../../Python2.4/include/object.h:129: error: expected ')' before '*'
token
../../Python2.4/include/object.h:130: error: expected ')' before '*'
token

Am I missing something important here?

Thanks in advance,

Marcelo


Jun 23 '06 #3
On 24/06/2006 7:51 AM, Marcelo Gosling wrote:
Hi, everyone.

This is on WinXP SP2, with Python 2.4.3 and DJGPP gcc 4.1.0.

I'm having trouble including Python.h in a C file. The following C
code:

#include "Python.h"

int main()
{
return 0;
}

when compiled with "gcc -I..\Python2.4\i nclude\", gives more than 1000
lines of errors, beginning with:

c:/documents and settings/marcelo.gosling/my
documents/djgpp/bin/as.exe: BFD 2.16.1 assertion fail
../../bfd/coff-i386.c:576
Hmmmm.... the *assembler* appears to be grumbling about its input. I'd
suspect that you have a mangled DJGPP installation. You may be better
asking on the DJGPP mailing list.

Aside: Wouldn't it have been better to install DJGPP in c:\djgpp????
c:/documents and settings/marcelo.gosling/my
documents/djgpp/tmp/ccACtxBR.s: Assembler messages:
c:/documents and settings/marcelo.gosling/my
documents/djgpp/tmp/ccACtxBR.s:28: Error: cannot represent relocation
type BFD_RELOC_386_P LT32
In file included from ../../Python2.4/include/Python.h:74,
from example_wrap.c: 112:


1. You allegedly have a 6-line test program. What is this example_wrap.c
that has 112 lines (or more) in it?
2. What was the full compiler command line?
3. What are you doing with DJGPP? Are you attempting to make an MS-DOS
port of Python?
4. Have you successfully compiled linked and executed anything with this
installation of DJGPP? Does the standard "Hello, world!" program work?
5. Have you tried compiling (not linking) this:

#include "Python.h"
void dummy() {}

HTH,
John
Jun 24 '06 #4
On 24/06/2006 12:14 PM, John Machin wrote:
On 24/06/2006 7:51 AM, Marcelo Gosling wrote:
I'm having trouble including Python.h in a C file. The following C
code: In file included from ../../Python2.4/include/Python.h:74,
from example_wrap.c: 112:


1. You allegedly have a 6-line test program. What is this example_wrap.c
that has 112 lines (or more) in it?


If you're trying to use SWIG (which could quite plausibly have created
an example_wrap.c from an example.c), wouldn't you be better off with
MinGW??????

I suggest you back away from your 1000-error-message train smash and try
telling us what you are trying to accomplish and a little bit more of
the history of how you got on this path.

Cheers,
John

Jun 24 '06 #5
"Marcelo Gosling" <ma************ *@gmail.com> wrote:

Hi, everyone.

This is on WinXP SP2, with Python 2.4.3 and DJGPP gcc 4.1.0.

I'm having trouble including Python.h in a C file. The following C
code:

#include "Python.h"

int main()
{
return 0;
}

when compiled with "gcc -I..\Python2.4\i nclude\", gives more than 1000
lines of errors, beginning with:

c:/documents and settings/marcelo.gosling/my
documents/djgpp/bin/as.exe: BFD 2.16.1 assertion fail
../../bfd/coff-i386.c:576
c:/documents and settings/marcelo.gosling/my
documents/djgpp/tmp/ccACtxBR.s: Assembler messages:
c:/documents and settings/marcelo.gosling/my
documents/djgpp/tmp/ccACtxBR.s:28: Error: cannot represent relocation
type BFD_RELOC_386_P LT32
In file included from ../../Python2.4/include/Python.h:74,
from example_wrap.c: 112:
../../Python2.4/include/pymem.h: In function '__declspec':
../../Python2.4/include/pymem.h:51: error: expected declaration
specifiers before '__declspec'
../../Python2.4/include/pymem.h:52: error: expected declaration
specifiers before '__declspec'


__declspec is a Microsoft extension. Are you trying to build the Visual
C++ source with gcc?
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jun 24 '06 #6

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

Similar topics

9
4938
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my webserver runs that part of the script (see attached file, snippet.php), though, it doesn't go through. I don't get an error message or...
4
2486
by: J Rice | last post by:
I have been experimenting with some thread programming, but as I'm doing this on my own I am worried I might be making a major mistake. Here's a brief rundown of what I am working on. Multiple threads, via Queue, are used to perform RBL checks on an IP. The threads are passed a defined class (ConnectionScore) in their init. This is used...
6
2237
by: Gonzalo Monzón | last post by:
Hi all! I have been translating some Python custom C extension code into Python, as I need these modules to be portable and run on a PocketPC without the need of compile (for the purpose its a must 2.4 as it is the last PythonCE release with great improvements). But I've been stuck with a script wich does not work as expected once...
7
1812
by: f pemberton | last post by:
I have a string (xdata) and theres a newline after every 17 characters of the string. I was wondering how I can replace multiple substrings multiple times within a string? To put it another way, this is what i want to do. Substring to find ("abcdef") replace it with ("highway") search again, substring to find ("defgef") replace it with...
8
1173
by: John Salerno | last post by:
I was just thinking, since Python 3.0 is supposed to clean up a lot of the unnecessary or redundant features of Python and make other things more streamlined, does it seem to anyone that including SQLite goes against this goal? This is just me thinking out loud, mind you, but it seems like including a database module (especially one that...
5
3487
by: tkondal | last post by:
Hi all. I just started looking at Python's ctypes lib and I am having trouble using it for a function. For starters, here's my Python code: from ctypes import*; myStringDLL= cdll.LoadLibrary("myStringDLL.dll");
3
4526
by: sab | last post by:
Hello, I have been working on a python script to parse a continuously growing log file on a UNIX server. The input is the standard in, piped in from the log file. The application works well for the most part, but the problem is when attempting to continuously pipe information into the application via the tail -f command. The command line...
0
1330
by: Basha J P M | last post by:
I am beginner in python. I am working through the tutorial examples from http://www.swig.org/ and have run into some problems. I took the following command instructions from the tutorial on swig.org: http://www.swig.org/tutorial.html I have written example.c and example.i as described in the above tutorial. My first attempt at compiling...
8
1674
by: J Kenneth King | last post by:
Hey everyone, I'm working on a python extension wrapper around Rob Hess' implementation of a SIFT feature detector. I'm working on a computer-vision based project that requires interfacing with Python at the higher layers, so I figured the best way to handle this would be in C (since my initial implementation in python was ungodly and...
0
7653
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7411
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7749
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5965
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5322
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4942
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3444
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3439
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
695
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.