473,406 Members | 2,549 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,406 software developers and data experts.

Distutils on windows with mingw, messed up includes?

Hi,

I am pretty lost here: My goal is to get an existing c++ library wrapped using distutils and swig. My C++ knowlege is very limited (so is my Python).

So I started with trying to wrap a single class from the library (I already have a simple example .cpp file packed into a .pyd correctly and it works fine with ipython) but when trying to do the same with this one:

Expand|Select|Wrap|Line Numbers
  1. #include "jcnError.h"
  2.  
  3. jcnError::jcnError(const string& message, const ErrorType& errorType)
  4. : std::runtime_error(message), mErrorMessage(message), mErrorType(errorType)
  5. {
  6. }
  7.  
  8. const char* jcnError::what(void) const throw()
  9. {
  10.     return std::runtime_error::what();
  11. }
  12.  
  13. jcnError::~jcnError(void) throw()
  14. {
  15. }
  16.  
I get an error from gcc: "iostream: no such file or directory". The includes are where they are supposed to be and with the -v option gcc tells me that it searches there as well, so what is the problem?

Here is the header:
Expand|Select|Wrap|Line Numbers
  1. #pragma once
  2.  
  3. #include <iostream>
  4. #include <string>
  5. #include <stdexcept>
  6.  
  7. using namespace std;
  8.  
  9. #define jcn_DEBUG /**< If this is defined more error messages will be thrown */
  10.  
  11. /**
  12. * Internal type of error
  13. */
  14. enum ErrorType 
  15. {
  16.     WARNING,
  17.     EXCEPTION,
  18. };
  19.  
  20. /**
  21. * @class jcnError
  22. * @author Jan C. Neddermeyer
  23. * @brief jcnError is inherited from the std error class runtime_error
  24. */
  25. class jcnError :
  26.     public runtime_error
  27. {
  28. public:
  29.     /**
  30.     * Constructor
  31.     * @param message error message, should provide detailed information where and why an error has been thrown
  32.     * @param errorType optional error type
  33.     */
  34.     jcnError(const string& message, const ErrorType& errorType = EXCEPTION);
  35.  
  36.     /**
  37.     * @return error message, corresponds to the what() method in runtime_error
  38.     */
  39.     virtual const char* what(void) const throw();
  40.  
  41.     /**
  42.     * @return error message as std::string
  43.     */
  44.     inline const string GetMessage(void) const {return mErrorMessage;};
  45.  
  46.     /**
  47.     * @return error type
  48.     */
  49.     inline const ErrorType GetErrorType(void) const {return mErrorType;};
  50.  
  51.     /**
  52.     * Destructor
  53.     */
  54.     ~jcnError(void) throw();
  55.  
  56. private:
  57.     string mErrorMessage; /**< error message */
  58.     ErrorType mErrorType; /**< error type */
  59. };
  60.  
and here my setup.py
Expand|Select|Wrap|Line Numbers
  1. import distutils
  2. from distutils.core import setup, Extension
  3.  
  4. module=Extension('_bpetest',sources=['bpe.i','jcnError.cpp'],include_dirs=['C:/users/kevin/Desktop/bpe_demo/src'])
  5.  
  6. setup(name="bpetest", version="3.2", ext_modules=[module])
  7.  
and finally the bpe.i:
Expand|Select|Wrap|Line Numbers
  1. %module bpetest
  2. %{
  3. #include "jcnError.h"
  4. %}
  5.  
all help appreciated,

thanks,

Kevin
Apr 2 '12 #1
0 1261

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Andrew Gregory | last post by:
In Python 2.2, I compiled some C++ code on Windows (MinGW compiler) to create an extension using distutils and the following setup.py file: from distutils.core import setup, Extension setup...
0
by: Phil Hornby | last post by:
I have tried posting this to the distutils SIG list but had no response so I am hoping the general list can help... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Okay, I love what I can do with...
1
by: Bengt Richter | last post by:
I'd like to override the default d:\Python23\Lib\site-packages\ destination, at least as an option. I have used installshield in the past, which gives extensive control over just about...
21
by: Alf P. Steinbach | last post by:
Just because there seems to be a lack of post-standard _correct_ tutorials: <url: http://home.no.net/dubjai/win32cpptut/>. Disclaimer: written this evening so perhaps there are "bugs" in the...
28
by: Alf P. Steinbach | last post by:
A few days ago I posted an "Hello, world!" tutorial, discussed in <url: http://groups.google.no/groups?threadm=41ba4c0a.76869078@news.individual.net>. As I wrote then: <quote> because there...
7
by: Alf P. Steinbach | last post by:
The fourth part of my attempted Correct C++ tutorial is now available, although for now only in Word format (use free Open Office if no Word), and also, it's not yet been reviewed at all -- ...
10
by: Alf P. Steinbach | last post by:
The fifth part of my attempted Correct C++ tutorial is now available, although for now only in Word format (use free Open Office if no Word), and also, it's not yet been reviewed at all -- ...
24
by: Alf P. Steinbach | last post by:
The eighth chapter (chapter 2.1) of my attempted Correct C++ tutorial is now available, although for now only in Word format -- comments welcome! Use the free & system-independent Open Office...
1
by: timw.google | last post by:
Hi all. I have a package that uses other packages. I created a setup.py to use 'try:' and import to check if some required packages are installed. I have the tarballs and corresponding windows...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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,...

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.