[Insight-users] Re: Build problem

Zhuang Song (Johnny) songz at seas . upenn . edu
Tue, 18 Nov 2003 20:08:23 -0500


HI Gavin,

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?

I tried the simple program like Helloworld and it passed. 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;
}


Zhuang



On Tue, 2003-11-18 at 18:39, Gavin Baker wrote:
> Hello,
> 
> On Tue, Nov 18, 2003 at 05:13:03PM -0500, Zhuang Song (Johnny) wrote:
> 
> > Thanks for the help. I have successfully built ITK itself. The only
> > difference than your steps is that I created the build directly inside
> > the source directory of InsightToolkit. Does this really matter? 
> 
> No, it doesn't matter where you put the build directory.  It is just
> preferrable to keep it separate from the source directory (for upgrades
> etc).
> 
> > The major problem was I only set the path for C++ compiler, but didn't
> > set that for C compiler. After I fixed this problem, the whole build
> > process for ITK itself had no error or warning message. 
> 
> Great!
> 
> > But when I
> > compile my own program, the compiler still can't understand C++ syntax,
> > such like the definition of vector variables:
> >            const vector< int >::iterator  iterator_x,
> >            const vector< int >::iterator  iterator_y,
> > it will give error message:
> >    parse error before `::' token
> >    'vector' undeclared (first use this function)
> > 
> > It seems C++ compiler still doesn't work. or is there other
> > configuration problem?
> 
> That looks more like there's just a missing #include <vector>.  It is hard
> to tell without seeing the rest of the code or how you are building it.  Are
> you using CMake?  That makes building things _much_ easier...
> 
> After you have done a 'make install', use the sample found in:
> 
>    InsightToolkit-1.4.0/Examples/Installation
> 
> to test your installation.  Just copy HelloWorld.cxx and CMakeLists.txt
> somewhere else, and build that.  Be sure to set ITK_DIR to point to wherever
> you installed it (eg. /usr/local/lib/itk).
> 
> If that doesn't work, we will need to see more detail to know what went
> wrong.  There is more discussion of this in Chapter 2 of the ITK Software
> Guide.
> 
>   :: Gavin
--