[Insight-users] Namespaces Problem

Luis Ibanez luis . ibanez at kitware . com
Wed, 21 Aug 2002 15:42:32 -0400


Hi Martin,

We tried without success to reproduce the
problem with namespaces that you report.

It may be caused by some of the additional
header files that you are including.

However, in the process of searching we
noticed that when you use ITK along with MFC,
the stdafx.h should go before any of the
ITK headers because ITK include <windows.h>


Could you please go back to the version
you have this morning where the original
problem was related with : strstream

You were reporting error like:

OsirisActiveXView.cpp
c:\program files\microsoft visual studio\vc98\include\strstream(51) : error
C2039: 'seekdir' : is not a member of 'ios'
         c:\program files\microsoft visual 
studio\vc98\include\ios.h(106) : see
declaration of 'ios'


It seems that an alternative fix is to exchange
the use of <strstream> for <sstream>

If you could reproduce this error in a minimal set
of files for which you can sent us all the files,
we must be able to identify the source of the problem.


Thanks

Luis


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

martin.garcia@epfl.ch wrote:
> Here you have the files, I think there is no namespace definition in them.
>  
> 
> 
> Quoting Luis Ibanez <luis.ibanez@kitware.com>:
> 
> 
>>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
>>>
>>>
> 
> 
> 
> 
> -------------------------------------------------
> This mail sent through IMP: http://horde.org/imp/
> 
> 
> ------------------------------------------------------------------------
> 
> // stdafx.h : include file for standard system include files,
> //  or project specific include files that are used frequently, but
> //      are changed infrequently
> //
> 
> #if !defined(AFX_STDAFX_H__B7FF423A_D399_462C_A633_52D910D3D2D5__INCLUDED_)
> #define AFX_STDAFX_H__B7FF423A_D399_462C_A633_52D910D3D2D5__INCLUDED_
> 
> #if _MSC_VER > 1000
> #pragma once
> #endif // _MSC_VER > 1000
> 
> #define VC_EXTRALEAN		// Exclude rarely-used stuff from Windows headers
> 
> #include <afxwin.h>         // MFC core and standard components
> #include <afxext.h>         // MFC extensions
> #include <afxdisp.h>        // MFC Automation classes
> #include <afxdtctl.h>		// MFC support for Internet Explorer 4 Common Controls
> #ifndef _AFX_NO_AFXCMN_SUPPORT
> #include <afxcmn.h>			// MFC support for Windows Common Controls
> #endif // _AFX_NO_AFXCMN_SUPPORT
> #include <afxtempl.h>
> 
> #define LISTPOINTS		CList<CPoint,CPoint>
> #define LPLISTPOINTS	LISTPOINTS*
> #define LIST3DOBJECTS	CList<C3DvtkObject*,C3DvtkObject*>
> #define LPLIST3DOBJECTS LIST3DOBJECTS*
> 
> #include ".\Include\UINDefs.h"
> #include "OView.h"
> #include "AVWImage.h"
> 
> 
> // Constants for ActiveX Document/View template
> #define OACTIVEX_VIEWMODE_SIMPLE			0
> #define OACTIVEX_VIEWMODE_HISTO				1
> #define OACTIVEX_VIEWMODE_RENDER3D			2
> #define OACTIVEX_VIEWMODE_PROFILE			3
> 
> #define OACTIVEX_HISTO_WIDTH		256
> #define OACTIVEX_HISTO_HEIGHT		256
> #define OACTIVEX_3DRENDER_WIDTH		256
> #define OACTIVEX_3DRENDER_HEIGHT	256
> #define OACTIVEX_PROFILE_WIDTH		256
> #define OACTIVEX_PROFILE_HEIGHT		256
> 
> #define WM_CHANGE_VIEWMODE  WM_USER+1
> 
> // OView constant
> #define OVIEW_GIO_DIB                 2
> #define OVIEW_GIO_BUFFER              3
> #define OVIEW_GIO_IMAGEMINPIXELVALUE  5
> #define OVIEW_GIO_IMAGEMAXPIXELVALUE  6
> #define OVIEW_GIO_IMAGEOFFSET         7
> #define OVIEW_GIO_IMAGESLOPE          8
> #define OVIEW_GIO_IMAGEWW             9
> #define OVIEW_GIO_IMAGEWL            10
> #define OVIEW_GIO_CURVETRANS         11
> #define OVIEW_GIO_CLUT               12
> #define OVIEW_GIO_TRANSFORM          13
> #define OVIEW_GIO_IMAGEBLACKSATURED  14
> #define OVIEW_GIO_COLORMASK_MIN      15
> #define OVIEW_GIO_COLORMASK_MAX      16
> #define OVIEW_GIO_COLORMASK_INSIDE   17
> #define OVIEW_GIO_COLORMASK_COLOR    18
> #define OVIEW_GIO_COLORMASK_PROCESS  19
> #define OVIEW_GIO_SLEEP              20
> #define OVIEW_GIO_KEEPIMAGE          21
> #define OVIEW_GIO_UNKEEPIMAGE        22
> 
> 
> #define NBIMAGETOOLS 7
> enum teImageTool { neutral, selector, roiRect, roiEllipse, roiPolygon, roiPencil, glass};
> 
> enum teVoxelFormat { unsigned8bits, signed8bits, unsigned16bits, signed16bits,
> 					 unsigned16bitsSwapped, signed16bitsSwapped };
> 
> typedef struct FILEINFO
> {
>   CString*			pstrFileName;
>   int				teFileType;
>   CString*			pstrFileType;
>   CSize				sizeImage;
>   int               iSelectFrom;
>   int               iSelectTo;
>   int				iImageCount;
>   int				teModality;
> } FILEINFO, *LPFILEFINFO;
> 
> typedef struct IMAGEDATA
> {
> 	int				iMinPixelValue;
>     int				iMaxPixelValue;
>     float			fOffset;
>     float			fSlope;
>     int				iWW;
>     int				iWL;
> 	LPBYTE			lpBuffer;
> 	LPBITMAPINFO	lpBMIH;
> } IMAGEDATA, *LPIMAGEDATA;
> 
> 
> 
> //{{AFX_INSERT_LOCATION}}
> // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
> 
> #endif // !defined(AFX_STDAFX_H__B7FF423A_D399_462C_A633_52D910D3D2D5__INCLUDED_)
> 
> 
> ------------------------------------------------------------------------
> 
> // OsirisLight.h : main header file for the OSIRISLIGHT application
> //
> 
> #if !defined(AFX_OSIRISLIGHT_H__142DAC21_DA0D_4DF3_AD36_8B2E1569754F__INCLUDED_)
> #define AFX_OSIRISLIGHT_H__142DAC21_DA0D_4DF3_AD36_8B2E1569754F__INCLUDED_
> 
> #if _MSC_VER > 1000
> #pragma once
> #endif // _MSC_VER > 1000
> 
> #ifndef __AFXWIN_H__
> 	#error include 'stdafx.h' before including this file for PCH
> #endif
> 
> #include "resource.h"       // main symbols
> #include "OsirisLightDoc.h"
> #include "AVWShowDoc.h"
> #include "3DvtkDoc.h"
> 
> /////////////////////////////////////////////////////////////////////////////
> // COsirisLightApp:
> // See OsirisLight.cpp for the implementation of this class
> //
> 
> class COsirisLightApp : public CWinApp
> {
> public:
> 	COsirisLightApp();
> 
> // Overrides
> 	// ClassWizard generated virtual function overrides
> 	//{{AFX_VIRTUAL(COsirisLightApp)
> 	public:
> 	virtual BOOL InitInstance();
> 	//}}AFX_VIRTUAL
> 
> // Implementation
> 	//{{AFX_MSG(COsirisLightApp)
> 	afx_msg void OnAppAbout();
> 	afx_msg void OnFileOpen();
> 	//}}AFX_MSG
> 
> 	DECLARE_MESSAGE_MAP()
> 
> public: 
> 	C3DvtkDoc*			Create3DvtkDocument( C3DvtkObject *p3DvtkObject, BOOL bTriangulate = TRUE );
> 	void				SetCurrentDocument( LPVOID pDoc ) { m_pCurrentDoc = pDoc; }
> 	LPVOID				GetCurrentDocument() { return m_pCurrentDoc; }
> private:
> 	LPVOID				m_pCurrentDoc;
> };
> 
> 
> /////////////////////////////////////////////////////////////////////////////
> 
> //{{AFX_INSERT_LOCATION}}
> // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
> 
> #endif // !defined(AFX_OSIRISLIGHT_H__142DAC21_DA0D_4DF3_AD36_8B2E1569754F__INCLUDED_)
> 
> 
> ------------------------------------------------------------------------
> 
> // VtkItkConnector.h: interface for the CVtkItkConnector class.
> //
> //////////////////////////////////////////////////////////////////////
> 
> #if !defined(AFX_VTKITKCONNECTOR_H__25C4D179_9827_4E33_8D21_1DB4864645F0__INCLUDED_)
> #define AFX_VTKITKCONNECTOR_H__25C4D179_9827_4E33_8D21_1DB4864645F0__INCLUDED_
> 
> #if _MSC_VER > 1000
> #pragma once
> #endif // _MSC_VER > 1000
> 
> class CVtkItkConnector  
> {
> public:
> 	vtkImageData* m_pImageData;
> 	CVtkItkConnector(vtkImageData* data);
> 	virtual ~CVtkItkConnector();
> 	template <typename ITK_Exporter, typename VTK_Importer>
>       void ConnectPipelines(ITK_Exporter exporter, VTK_Importer* importer);
> 	template <typename VTK_Exporter, typename ITK_Importer>
>       void ConnectPipelines(VTK_Exporter* exporter, ITK_Importer importer);
> 
> 
> 
> };
> 
> #endif // !defined(AFX_VTKITKCONNECTOR_H__25C4D179_9827_4E33_8D21_1DB4864645F0__INCLUDED_)
>