Distutils on windows with mingw, messed up includes?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kevin Kunzmann
    New Member
    • Apr 2012
    • 1

    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:

    Code:
    #include "jcnError.h"
    
    jcnError::jcnError(const string& message, const ErrorType& errorType)
    : std::runtime_error(message), mErrorMessage(message), mErrorType(errorType)
    {
    }
    
    const char* jcnError::what(void) const throw()
    {
    	return std::runtime_error::what();
    }
    
    jcnError::~jcnError(void) throw()
    {
    }
    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:
    Code:
    #pragma once
    
    #include <iostream>
    #include <string>
    #include <stdexcept>
    
    using namespace std;
    
    #define jcn_DEBUG /**< If this is defined more error messages will be thrown */
    
    /**
    * Internal type of error
    */
    enum ErrorType 
    {
    	WARNING,
    	EXCEPTION,
    };
    
    /**
    * @class jcnError
    * @author Jan C. Neddermeyer
    * @brief jcnError is inherited from the std error class runtime_error
    */
    class jcnError :
    	public runtime_error
    {
    public:
    	/**
    	* Constructor
    	* @param message error message, should provide detailed information where and why an error has been thrown
    	* @param errorType optional error type
    	*/
    	jcnError(const string& message, const ErrorType& errorType = EXCEPTION);
    
    	/**
    	* @return error message, corresponds to the what() method in runtime_error
    	*/
    	virtual const char* what(void) const throw();
    
    	/**
    	* @return error message as std::string
    	*/
    	inline const string GetMessage(void) const {return mErrorMessage;};
    
    	/**
    	* @return error type
    	*/
    	inline const ErrorType GetErrorType(void) const {return mErrorType;};
    
    	/**
    	* Destructor
    	*/
    	~jcnError(void) throw();
    
    private:
    	string mErrorMessage; /**< error message */
    	ErrorType mErrorType; /**< error type */
    };
    and here my setup.py
    Code:
    import distutils
    from distutils.core import setup, Extension
    
    module=Extension('_bpetest',sources=['bpe.i','jcnError.cpp'],include_dirs=['C:/users/kevin/Desktop/bpe_demo/src'])
    
    setup(name="bpetest", version="3.2", ext_modules=[module])
    and finally the bpe.i:
    Code:
    %module bpetest
    %{
    #include "jcnError.h"
    %}
    all help appreciated,

    thanks,

    Kevin
Working...