[Insight-users] How to use itk with MFC?

Luis Ibanez luis.ibanez at kitware.com
Thu Sep 14 11:16:55 EDT 2006


Hi TaoKai

Please remove the ".ico" file from


 > SET(RESOURCE_FILES
 >  myApp.rc
 >  res/myApp.ico
 >  )



The file myApp.rc already should be referring
to the res/myApp.ico file internally.

Make sure that there is a line about res\\myApp.ico
inside myApp.rc



Regards,


    Luis


-------------------
Tao Kai wrote:
> hi all,
> I'm building a MFC program with some ITK feature, but I met a serious 
> problem:
> first I create a common single-view MFC program with Visual Studio, the 
> project name is myAPP,
> then I create a CMakelists file under the same folder and write it like 
> this:
>  
>     
> 
> PROJECT(myApp)
> 
> # This INCLUDE is to allow developers with both MSVC and Borland 
> compilers installed
> # to manually change the FindVTK results to point to the correct (MSVC) 
> vtk build directory
> 
> IF( BUILD_OUTSIDE_INSIGHT_APPLICATIONS )
> 
>   FIND_PACKAGE(ITK)
>   IF(ITK_FOUND)
>     INCLUDE(${ITK_USE_FILE})
>   ELSE(ITK_FOUND)
>     MESSAGE(FATAL_ERROR
>             "Cannot build InsightApplications without ITK.  Please set 
> ITK_DIR.")
>   ENDIF(ITK_FOUND)
> 
> 
> ENDIF( BUILD_OUTSIDE_INSIGHT_APPLICATIONS )
>  
> IF (NOT USE_ITK_FILE)
>   INCLUDE (${CMAKE_ROOT}/Modules/FindITK.cmake)
> ENDIF (NOT USE_ITK_FILE)
> 
> IF (USE_ITK_FILE)
>   INCLUDE(${USE_ITK_FILE})
> ENDIF (USE_ITK_FILE)
> 
> FILE(GLOB SOURCE_FILES "*.cpp")
> FILE(GLOB HEADER_FILES "*.h")
> 
> SET(RESOURCE_FILES
>  myApp.rc
>  res/myApp.ico
>  )
> SET( myApp_SRCS
>  ${SOURCE_FILES}
>  ${HEADER_FILES}
>  ${RESOURCE_FILES}
> )
> 
> SOURCE_GROUP("Source" FILES ${SOURCE_FILES})
> SOURCE_GROUP("Header" FILES ${HEADER_FILES})
> SOURCE_GROUP("Resource" FILES ${RESOURCE_FILES})
> 
> LINK_LIBRARIES(
>   ITKCommon
>   ITKIO
>   ITKBasicFilters
>   ITKNumerics
>   ITKAlgorithms
>   ITKFEM
>   ITKStatistics
>   shlwapi
> )
> 
> SET(CMAKE_BUILD_SETTING_CXX_FLAGS "  /W3 /Zm1000 /GX /GR")
> SET(CMAKE_BUILD_SETTING_CXX_FLAGS_DEBUG "/MDd /Zi /Od /GZ")
> SET(CMAKE_BUILD_SETTING_CXX_FLAGS_RELEASE "/MD /O2")
> 
> ADD_DEFINITIONS(-D_AFXDLL)
> SET(CMAKE_MFC_FLAG 6)
> ADD_EXECUTABLE(myApp WIN32 ${myApp_SRCS})
> 
>  and then I use CMake with this folder and generated some extra file 
> such as ALL_BUILD.vcproj,
> 
> then I build the solution again, but some surprising thing happen, shown 
> in the picture below attached.
> 
> the information was as follow:
> 
> c:\Documents and Settings\Taokai\My Documents\Visual Studio 
> Projects\MFC_Test\myApp\res\myApp.ico error C2018: unknown character '0x1'
> c:\Documents and Settings\Taokai\My Documents\Visual Studio 
> Projects\MFC_Test\myApp\res\myApp.ico error C2018: unknown character '0x1'
> c:\Documents and Settings\Taokai\My Documents\Visual Studio 
> Projects\MFC_Test\myApp\res\myApp.ico error C2018: unknown character '0x1'
> c:\Documents and Settings\Taokai\My Documents\Visual Studio 
> Projects\MFC_Test\myApp\res\myApp.ico error C2018: unknown character '0x1'
> c:\Documents and Settings\Taokai\My Documents\Visual Studio 
> Projects\MFC_Test\myApp\res\myApp.ico error C2018: unknown character '0x10'
> c:\Documents and Settings\Taokai\My Documents\Visual Studio 
> Projects\MFC_Test\myApp\res\myApp.ico error C2018: unknown character '0x10'
> c:\Documents and Settings\Taokai\My Documents\Visual Studio 
> Projects\MFC_Test\myApp\res\myApp.ico error C2018: unknown character '0x10'
> c:\Documents and Settings\Taokai\My Documents\Visual Studio 
> Projects\MFC_Test\myApp\res\myApp.ico error C2018: unknown character '0x10'
> c:\Documents and Settings\Taokai\My Documents\Visual Studio 
> Projects\MFC_Test\myApp\res\myApp.ico error C2018: unknown character '0x5'
> c:\Documents and Settings\Taokai\My Documents\Visual Studio 
> Projects\MFC_Test\myApp\res\myApp.ico error C2018: unknown character '0x6'
> c:\Documents and Settings\Taokai\My Documents\Visual Studio 
> Projects\MFC_Test\myApp\res\myApp.ico error C2018: unknown character '0x8'
> c:\Documents and Settings\Taokai\My Documents\Visual Studio 
> Projects\MFC_Test\myApp\res\myApp.ico error C2018: unknown character '0x6'
> c:\Documents and Settings\Taokai\My Documents\Visual Studio 
> Projects\MFC_Test\myApp\res\myApp.ico error C2018: unknown character '0x8'
> c:\Documents and Settings\Taokai\My Documents\Visual Studio 
> Projects\MFC_Test\myApp\res\myApp.ico error C2018: unknown character '0x8'
> c:\Documents and Settings\Taokai\My Documents\Visual Studio 
> Projects\MFC_Test\myApp\res\myApp.ico error C2059: syntax error : 'constant'
> c:\Documents and Settings\Taokai\My Documents\Visual Studio 
> Projects\MFC_Test\myApp\res\myApp.ico error C3209: '
> c:\Documents and Settings\Taokai\My Documents\Visual Studio 
> Projects\MFC_Test\myApp\res\myApp.ico error C3209: '' : Unicode 
> identifiers are not yet supported
> c:\Documents and Settings\Taokai\My Documents\Visual Studio 
> Projects\MFC_Test\myApp\res\myApp.ico error C3209: '' : Unicode 
> identifiers are not yet supported
> c:\Documents and Settings\Taokai\My Documents\Visual Studio 
> Projects\MFC_Test\myApp\res\myApp.ico error C3209: ' ' : Unicode 
> identifiers are not yet supported
> c:\Documents and Settings\Taokai\My Documents\Visual Studio 
> Projects\MFC_Test\myApp\res\myApp.ico error C3209: ' 00' : Unicode 
> identifiers are not yet supported
> c:\Documents and Settings\Taokai\My Documents\Visual Studio 
> Projects\MFC_Test\myApp\res\myApp.ico fatal error C1004: unexpected end 
> of file found
> myApp warning C4821: Unable to determine Unicode encoding type, please 
> save the file with signature (BOM)
> 
> I have never seen such problem before. Does anyone know why? please help!
> 
> Any help will be greatly appreciated!
> 
>  
> 
> Taokai
> 
> Sep 2, 2006
> 
>  
> 
>  
> 
>  
>  
>  
>  
>  
>  
> 
> ------------------------------------------------------------------------
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users




More information about the Insight-users mailing list