I’m completely new to SWIG and trying to wrap C++ into C#.

One of my classes uses std::ostream. However, all my attempts to include swig’s “std_iostream.i” result in needing to suppress an error and swig hitting a syntax error “std_basic_string.i” file, even if I have nothing else in my own interface file.

The line in question is “%traits_swigtype(_CharT);” and is in a swig library file, included by “std_iostream.i”


Is anyone familiar with what is going wrong?

Additionally, can anyone explain how exactly one uses “std_iostream.i”, beyond just including it?



/* File : MyClass.i */

%module MyClass_module

%include <std_iostream.i>


C:\workspace\Release\include>swig -c++ -csharp -I"C:\Program Files (x86)\swigwin-3.0.2\Lib\std" -cpperraswarn myclass.i

C:\Program Files (x86)\swigwin-3.0.2\Lib\std\std_except.i(2) : Warning 205: CPP

#error ""do not use this version of std_except.i"".

C:\Program Files (x86)\swigwin-3.0.2\Lib\std\std_basic_string.i(44) : Error: Syntax error in input(3).









IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.