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: -
#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: -
#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 -
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: -
%module bpetest
-
%{
-
#include "jcnError.h"
-
%}
-
all help appreciated,
thanks,
Kevin
0 1261 Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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 -- ...
|
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 -- ...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
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...
|
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,...
|
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...
|
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,...
|
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...
|
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,...
| | |