[Insight-users] Re: Build problem

Zhuang Song (Johnny) songz at seas . upenn . edu
Wed, 19 Nov 2003 12:41:43 -0500


Hello Gavin,
Yeah, it works!! Sorry for the namespace mistake. It worked well before
even without specifying the std namespace, because I just copied it from
my old program. I tried it again in my another computer with older
version compiler, and it did work without specifying the std namespace.
Maybe the newer compiler is more strict on this. Anyway, I appreciate
your kind help.

Zhuang



On Tue, 2003-11-18 at 20:22, Gavin Baker wrote:
> Hello Zhuang,
> 
> On Tue, Nov 18, 2003 at 08:08:23PM -0500, Zhuang Song (Johnny) wrote:
> 
> > I use CMake 1.9. I skipped the 'make install ' step because it is
> > optional and I don't have the permission to create a directory under
> > /usr/local/ in our computer. Is it all right?
> 
> Sure, that's fine.  But you can always install it to your own home
> directory, like ~/local/itk if you wish.
> 
> > I tried the simple program like Helloworld and it passed. 
> 
> Great!  Then it has all worked.
> 
> > But if I added only one line to define a vector, the compiler will give
> > error message, the same as I mentioned in previous letter. The code is as
> > simple as:
> > 
> > #include "itkImage.h"
> > #include <iostream>
> > #include <vector>
> > 
> > int main()
> > {
> >   typedef itk::Image< unsigned short, 3 > ImageType;
> > 
> >   ImageType::Pointer image = ImageType::New();
> > 
> >   // the following added by ZS.
> >   vector< int >::iterator  iterator_x,
> >   // end of change.
> >   
> >   std::cout << "ITK Hello World !" << std::endl;
> >   return 0;
> > }
> 
> That's a C++ namespace problem (nothing to do with ITK).  You need to
> specify the std namespace when using vector, like this:
> 
>   std::vector<int>::iterator iterator_x;
> 
> (Also note that you have a comma at the end of the line, whereas it should be
> a semicolon.)
> 
> Now that you have built ITK successfully, you probably want to go through
> the examples and the Software Guide.  Also the tutorials section on the ITK
> website has a lot of good material.
> 
> Have fun!
> 
>   :: Gavin
-- 
Johnny