[Insight-users] Namespaces Problem

Luis Ibanez luis . ibanez at kitware . com
Wed, 21 Aug 2002 08:00:16 -0400


This is a multi-part message in MIME format.
--------------090903080203020209090803
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hi Martin,

We just tried jour code snippet.

It works fine when the includes:

   #include "stdafx.h"
   #include "osirislight.h"
   #include "VtkItkConnector.h"

are commented out.

There should be a wrong usage of
namespaces inside one of these files.

Could you please post those files ?
or at least verify the namespaces
are used correctly inside.

One common error is to declare a namespace
and let it open (e.g. miss the closing bracket)

like:

namespace  MyOpenNamespace {

///....

// unmatching  -> }



----

Please find attached the CMakeList.txt file
and the variation of your code that we tested
here.

Thanks,


Luis


=====================================

martin.garcia@epfl.ch wrote:
> Hi ,
> 
> I'm working with VC++6.0 (sp 6), and I'm trying to integrate itk 
> functionalities to my project, but when I use namespaces, I always have the 
> following compilation error
> 

--------------090903080203020209090803
Content-Type: text/plain;
 name="CMakeLists.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="CMakeLists.txt"

PROJECT(SampleProject)

# 
# Find ITK
#
INCLUDE (${CMAKE_ROOT}/Modules/FindITK.cmake)
IF (USE_ITK_FILE)
  INCLUDE(${USE_ITK_FILE})
ENDIF(USE_ITK_FILE)

LINK_LIBRARIES (
ITKCommon
)

INCLUDE (${ITK_SOURCE_DIR}/Utilities/ITKFindVTK.cmake)
IF (USE_VTK_FILE)
  INCLUDE (${USE_VTK_FILE})
  # Test for VTK using std libs
  IF(VTK_USE_ANSI_STDLIB)
    SET(HAS_VTK 1 CACHE INTERNAL "VTK Headers and Libraries are available")
  ELSE( VTK_USE_ANSI_STDLIB )
    MESSAGE ("Warning. Your VTK was not built with the VTK_USE_ANSI_STDLIB option ON. \nPlease reconfigure and recompile VTK with this option before trying to use it with ITK.")
  ENDIF( VTK_USE_ANSI_STDLIB )
  # Test for VTK building Hybrid
  IF(VTK_USE_HYBRID)
    SET(HAS_VTK_HYBRID 1 CACHE INTERNAL "VTK Hybrid libraries are available")
  ELSE( VTK_USE_HYBRID )
    MESSAGE ("Warning. Your VTK was not built with the VTK_USE_HYBRID option ON. \nPlease reconfigure and recompile VTK with this option before trying to use it with ITK.")
  ENDIF( VTK_USE_HYBRID )
ELSE (USE_VTK_FILE)
  MESSAGE("The UseVTK.cmake file was not found. You will not be able to build code requiring VTK")
  SET(HAS_VTK 0 CACHE INTERNAL "Use VTK: The Visualization Toolkit, this is required for some examples but not for the ITK toolkit")
ENDIF (USE_VTK_FILE)



ADD_EXECUTABLE(itkSampleProject itkSampleProject.cxx )


--------------090903080203020209090803
Content-Type: text/plain;
 name="itkSampleProject.cxx"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="itkSampleProject.cxx"

//////////////////////////////////////////////////////////////////////
//
// VtkItkConnector.cpp: implementation of the CVtkItkConnector class.
//
//////////////////////////////////////////////////////////////////////
#include <itkImage.h>
#include <itkCommand.h>
#include <itkVTKImageExport.h>
#include <itkVTKImageImport.h>
#include <itkPNGImageIO.h>


// #include "stdafx.h"
// #include "osirislight.h"
// #include "VtkItkConnector.h"
#include "vtkImageData.h"
#include "vtkImageExport.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////


class CVtkItkConnector
{
  public:
    CVtkItkConnector(vtkImageData* data);
    ~CVtkItkConnector();
  private:
    vtkImageData * m_pImageData;
};


CVtkItkConnector::CVtkItkConnector(vtkImageData* data)
{
	m_pImageData=data;
	vtkImageExport* vtkExporter=vtkImageExport::New();
	vtkExporter->SetInput(m_pImageData);

	//VTK to ITK Pipeline connection

	typedef itk::Image<float,2> ImageType;
	typedef itk::VTKImageImport<ImageType> ImageImportType;

}

CVtkItkConnector::~CVtkItkConnector()
{
	m_pImageData->Delete();
}



--------------090903080203020209090803--