[Insight-developers] help with wrapping wrap_itkWatershedImageFilter
Brad King
brad.king at kitware.com
Fri, 05 Mar 2004 15:11:47 -0500
Charl P. Botha wrote:
> Dear developers,
>
> I'm trying to wrap the itkWatershedImageFilter class. After having created
> the attached wrap_itkWatershedImageFilter.cxx file in the Wrapping/CSwig/
> Algorithms directory and having made the changes shown in the attached diff
> file, I get the following build errors on Debian Stable, g++ 2.95.4:
>
> Building wrap_itkWatershedImageFilter.xml from /home/cpbotha/DoNotBackup/
> build/Insight-gcc/Wrapping/CSwig/Algorithms/
> wrap_itkWatershedImageFilter.xml...
> In file included from /home/cpbotha/DoNotBackup/build/Insight/Code/Algorithms/
> itkWatershedBoundary.h:30,
> from /home/cpbotha/DoNotBackup/build/Insight/Code/Algorithms/
> itkWatershedSegmenter.h:25,
> from /home/cpbotha/DoNotBackup/build/Insight/Code/Algorithms/
> itkWatershedImageFilter.h:26,
> from /home/cpbotha/DoNotBackup/build/Insight/Wrapping/CSwig/Algorithms/
> wrap_itkWatershedImageFilter.cxx:18:
> /home/cpbotha/DoNotBackup/build/Insight/Code/Common/itk_hash_map.h:112: error:
> ISO C++ forbids declaration of `select1st' with no type
> /home/cpbotha/DoNotBackup/build/Insight/Code/Common/itk_hash_map.h:112: error:
> template-id `select1st<pair<const Key, T> >' used as a declarator
> /home/cpbotha/DoNotBackup/build/Insight/Code/Common/itk_hash_map.h:112: error:
> syntax error before `;' token
>
> Does anyone have any ideas? As far as I can see, "select1st" is declared in
> the stl_function.h on my system. "functional", which includes
> stl_function.h, is included somewhere in the itk_hash_map.h hierachy.
The problem is that GCC 2.95 has the fake std namespace hack, but
GCC-XML uses GCC 3.3's parser which does not have the hack. There is a
directory in GCC-XML that contains header wrappers to move all standard
library symbols into the std namespace with using declarations. Since
select1st and select2nd are not actually part of the C++ standard, these
symbols were not included when I made a sweep through the standard to
list all symbols. I've committed a fix to the header wrapper for
functional that includes these symbols. The fix is on the main tree and
in the ITK 1.6 branch of CableSwig.
-Brad