[Distutils] Distutils on windows with mingw, messed up includes?

Kevin Kunzmann kevinkunzmann at gmx.net
Tue Apr 3 08:09:36 CEST 2012


I am trying to wrap some c++ library using distutils and swig. So I 
started with some simple example files and got a faculty function 
wrapped and runing in ipython. When doing the same with this one:

here is the .cpp:

#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()

here is the header:

#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

* @class jcnError
* @author Jan C. Neddermeyer
* @brief jcnError is inherited from the std error class runtime_error
class jcnError :
     public runtime_error
     * 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 = 

     * @return error message, corresponds to the what() method in 
     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();

     string mErrorMessage; /**< error message */
     ErrorType mErrorType; /**< error type */

here the bpe.i:

%module bpetest
#include "jcnError.h"

and finally the setup.py:

import distutils
from distutils.core import setup, Extension


setup(name="bpetest", version="3.2", ext_modules=[module])

I get an error "iostream: No such file or directory". What's the 
problem? Does distutils get confused by all the virtuals? The error is 
raised on the very first include line of the headerfile "#include 
<iostream>" .



More information about the Distutils-SIG mailing list