[Insight-users] Re: MFC + CMake "failed to create empty document"

Luis Ibanez luis . ibanez at kitware . com
Mon, 08 Dec 2003 11:13:32 -0500


Hi Thimmaiah,

The reason for getting the message

     "failed to create empty document"

when you configure your MFC application with CMake is
that the resources are not being regenerated during the
build.  In order to force this generation, the file with
extension ".rc" must be added to the list of source
files in your CMakeLists.txt file.

A typical CMakeLists.txt file will look like:


PROJECT( ItkMFC )
ADD_DEFINITIONS(-D-AFXDLL)
SET(CMAKE_MFC_FLAG 6)

SET( ItkMFC_SRCS
    StdAfx.cpp
    ItkMFC.cpp
    ItkMFC.rc    <<<< This files may be missing in your case
    ItkMFCDoc.cpp
    MainFrm.cpp
    ItkMFCView.cpp
    )

LINK_LIBRARIES( wsock32 )

FIND_PACKAGE( ITK )
IF( ITK_FOUND )
    INCLUDE( ${ITK_USE_FILE )
ENDIF( ITK_FOUND )

ADD_EXECUTABLE( ItkMFC  WIN32 ${ItkMFC_SRCS} )
TARGET_LINK_LIBRARIES( ItkMFC ${ITK_LIBRARIES} )




Regards,


   Luis


------------------------------------------
> Hi,
> When I execute my MFC application it runs good. But when I use cmake it
> goes to command prompt. If I run from command prompt also it gives me this
> error. when I  give exe file I get this message "failed to create empty
> document". My application just reads a file name using MFC. Sorry to mail
> about MFC & Cmake here but I am trying to integrate this with itk.Thank you