[Insight-users] Re: Build problem

Gavin Baker gavinb+xtk at cs . mu . OZ . AU
Wed, 19 Nov 2003 12:22:56 +1100


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

-- 
Gavin Baker                                      Complex Systems Group
http://www . cs . mu . oz . au/~gavinb             The University of Melbourne