[Insight-users] Re: Problems in combining ITK with MFC program created by MS VC++

Luis Ibanez luis . ibanez at kitware . com
Mon, 07 Jul 2003 11:09:47 -0400


Hi Zheng,

ITK is independent of any GUI.  You ca build
your program using MFC, Qt, wxWindows, FLTK
or any other GUI library.

Please see the previous posting to the
list concerning the configuration of
MFC applications with CMake.

http://www . itk . org/pipermail/insight-users/2003-March/002751 . html

You only need to create a single CMakeLists.txt
file and let CMake configure the VisualStudio
workspace for you. However you will not be able
to use the Wizard from visual studio since the
.dsw should be created by CMake.


Regards,


   Luis



----------------------
zheng yuanjie wrote:
> Hi, Luis
> 
> I am a green hand of ITK. I have been using Microsft Visual C++ with 
> Windows xp. You know all the examples in ITK are console program, and 
> now I can succeed in processing them. But I wonder if I can use all the 
> mechanisms provided in the toolkit like /itkImageFileReader/ and 
> /itkImageFileWriter/ etc. in MFC based program created by MS VC.
> 
> I have tried to do it, however I failed. Now I list the processes done 
> by me as below:
> 
> 1. I created a new workspace named /TestITK /with /MFC AppWizard(exe)/ 
> by Microsoft Visulal C++ 6.0. It’s an application of single document. 
> All the files of the workspace has also been sent to you in the appendix 
> of your email.
> 
> 2. I wrote two /CMakeLists/ files, and saved them under the /TestITK/ 
> folder and /res/ folder (created by /MFC AppWizard(exe)/ respectively. 
> The content of one of the two /CMakeLists/ files is listed below:
> 
> PROJECT(mTestITK)
> 
>  
> 
> # Find ITK.
> 
> FIND_PACKAGE(ITK)
> 
> IF(ITK_FOUND)
> 
>   INCLUDE(${ITK_USE_FILE})
> 
> ELSE(ITK_FOUND)
> 
>   MESSAGE(FATAL_ERROR
> 
>           "Cannot build without ITK.  Please set ITK_DIR.")
> 
> ENDIF(ITK_FOUND)
> 
>  
> 
> ADD_EXECUTABLE(mTestITK MainFrm.cpp MainFrm.h resource.h StdAfx.cpp 
> StdAfx.h TestITK.cpp TestITK.h TestITK.rc TestITKDoc.cpp TestITKDoc.h 
> TestITKView.cpp TestITKView.h )
> 
> TARGET_LINK_LIBRARIES(mTestITK ITKCommon ITKIO)
> 
>  
> 
> SUBDIRS(
> 
>   res
> 
> )
> 
> The content of the other one under the /res/ folder is:
> 
> PROJECT(mTestITK)
> 
> ADD_EXECUTABLE(mTestITK TestITK.ico TestITK.rc2 TestITKDoc.ico Toolbar.bmp)
> 
> 3. I configured all the files under /TestITK/ folder with /CMake/, and I 
> succeeded in doing it.
> 
> 4. I opened the workspace created by /CMake/ with Microsoft Visual C++ 
> 6.0, however I can’t built it.
> 
> Would you please tell me that the reasons of my failure, and how I can 
> combine ITK with MFC based program created by MS VC++?
> 
> Thank you in advance!
> 
> Sincerely yours,
> 
> Zheng
> 
> 
> ------------------------------------------------------------------------
> *Do You Yahoo!?*
> 国内电邮用户反垃圾调查拉开帷幕 
> <http://cn . rd . yahoo . com/mail_cn/tag/?http://cn . tech . yahoo . com/zhuanti/laji/index . html> 
>