On Jun 4, 2011, at 1:21 PM, Alvin Penner wrote:
attempting to compile rev 10255 on Windows XP, get the error message:
--- compile / cc cc : compile of build/obj/ui/dialog/filedialogimpl-win32.o required by sourc e: src/ui/dialog/filedialogimpl-win32.cpp ============ cmd ============
Oh, good. Those appear to be simple and easy to address:
============================= Make error line 300: problem compiling: src/document.h: In member function 'bool Inkscape::UI::Dialog::FileOpenDialogImplWin32::set_svg_preview()': src/document.h:99:13: error: 'SPRoot* SPDocument::root' is private src/ui/dialog/filedialogimpl-win32.cpp:966:16: error: within this context src/document.h:99:13: error: 'SPRoot* SPDocument::root' is private
The error is because the data member was changed to be private (exactly what was reported). The fix, in this case, is quite simple. Instead of accessing the data member directly as in
static_cast<SPItem *>(svgDoc->root)->invoke_bbox( maybeArea, static_cast<SPItem *>(svgDoc->root)->i2d_affine(), TRUE);
we use the accessor method and it becomes:
static_cast<SPItem *>(svgDoc->getRoot())->invoke_bbox( maybeArea, static_cast<SPItem *>(svgDoc->getRoot())->i2d_affine(), TRUE);
HOWEVER...
Thee is a second issue with these lines of code. The casts should not be needed in C++ code, are are left over from C-only coding. They should be simple to remove (especially now that getRoot() returns SPRoot* instead of the generic SPObject*)
svgDoc->getRoot()->invoke_bbox( maybeArea, svgDoc->getRoot()->i2d_affine(), TRUE);
Among other things, when the code goes to use a pointer to a subclass (SPRoot in this case), it will automatically get access to all parent class methods (SPItem's calls to invoke_bbox() and i2d_affine() in this case).
So getting rid of the c-style casting is a very good thing, leads to simpler code, and removes the potential for many bugs.
src/ui/dialog/filedialogimpl-win32.cpp:992:35: error: within this context src/ui/dialog/filedialogimpl-win32.cpp:992:39: error: invalid static_cast from t ype 'SPRoot*' to type 'SPItem*' src/document.h:99:13: error: 'SPRoot* SPDocument::root' is private src/ui/dialog/filedialogimpl-win32.cpp:993:39: error: within this context src/ui/dialog/filedialogimpl-win32.cpp:993:43: error: invalid static_cast from t ype 'SPRoot*' to type 'SPItem*'
And finally to address the "invalid static_cast" errors. Those usually come from either the source or the target types not being defined. So one or both needed header files have not been included. Generally a subclass' header file will actually bring in the header for it's parent class, so simply adding that subclass include should finish clearing things up.
#include <sp-root.h>
And then that should do the trick.
If you check revision 10256 in trunk, you can let us know if it fixes the whole compile or not. Thanks.