[C++-sig] Boost Python private members problem

Eduardo Picado eduardo.picado at gmail.com
Thu Aug 24 18:09:00 CEST 2006


On 8/23/06, David Abrahams <dave at boost-consulting.com> wrote:
> "Eduardo Picado" <eduardo.picado at gmail.com> writes:
>
> > I'm facing a problem with the last module I need to compile with Boost Python.
> > I receive this compilation error:
> >
> > Compiling...(with vc-8_0)
> > TASRLogger.cpp
> > C:\Python24\include\TASRLogger.hpp(353) : error C2248:
> > 'TASRLogger::TASRLogger' : cannot access private member declared in
> > class 'TASRLogger'
> >         C:\Python24\include\TASRLogger.hpp(37) : see declaration of
> > 'TASRLogger::TASRLogger'
> >         C:\Python24\include\TASRLogger.hpp(33) : see declaration of 'TASRLogger'
> >         This diagnostic occurred in the compiler generated function
> > 'TASRDefaultLogger::TASRDefaultLogger(const TASRDefaultLogger &)'
> >
> > It's hard find a solution for the problem as I don't have the sources
> > for the dll. Otherwise I could at least change the member attributes
> > visibility.
>
> Actually you mean access I think.  In C++ you don't get direct control
> over visibility.
>

Yes.

> > Is there a workaround for it?
>
> This is strictly illegal, of course, but I think you have only one
> choice: just change the access from private to public in the header
> file.  The chance of breaking something is practically nil.
>

I had already tried it, and it gave me other errors.
Now I've seem it's a good solution, and the other errors really look
like a DLL version problem.

Thanks very much.


> Well... actually you have another choice.  You could add a friend
> declaration to the header and use the friend to do the access.  But
> there's not much advantage in it.
>
> --
> Dave Abrahams
> Boost Consulting
> www.boost-consulting.com
>
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig
>


-- 
Eduardo PICADO
MSN eduardo.picado at gmail.com
portable +33 6 32 47 10 10 (NEW)
fix +33 1 45 03 52 54
|̲̅<̲̅Θ̲̅>̲̅|


More information about the Cplusplus-sig mailing list