CMake error when building with MFC

Dear Development Team,

I am currently trying to follow Lesson 3: "Compile OpenCascade with MFC samples," but I am encountering a CMake error when building with MFC.

The error message is as follows:

CMake Error at samples/mfc/standard/mfcsample/CMakeLists.txt:123 (add_library):
Cannot find source file:

C:/Users/95439/source/repos/arungoooo112/OCCT/samples/mfc/standard/Common/User_Cylinder.hxx

Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm
.ccm .cxxm .c++m .h .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90
.f95 .f03 .hip .ispc

I cannot find the file “User_Cylinder.hxx” in source code.

I hope you can provide some assistance and tell me how to solve this problem.

Looking forward to your reply,

frankrun King's picture

I downloaded this file "User_Cylinder.hxx" from the internet and fixed this bug, but then these problems appeared:

CMake Error at samples/mfc/standard/03_ImportExport/CMakeLists.txt:38 (add_executable):  
Cannot find source file:    C:/Users/95439/Documents/VsCode/OCCT/samples/mfc/standard/05_ImportExport/src/ColoredShapes.cpp  
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm  .ccm .cxxm .c++m .h .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90  .f95 .f03 .hip .ispc

CMake Error at samples/mfc/standard/04_HLR/CMakeLists.txt:64 (add_executable):  
Cannot find source file:    C:/Users/95439/Documents/VsCode/OCCT/samples/mfc/standard/08_HLR/src/HLRApp.cpp  
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm  .ccm .cxxm .c++m .h .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90  .f95 .f03 .hip .ispc

CMake Error at samples/mfc/standard/03_ImportExport/CMakeLists.txt:38 (add_executable):  
No SOURCES given to target: ImportExport

CMake Error at samples/mfc/standard/04_HLR/CMakeLists.txt:64 (add_executable):  
No SOURCES given to target: HLR

Do I also need to separately download the files 05_ImportExport/src/ColoredShapes.cpp and 08_HLR/src/HLRApp.cpp?

Jerry Ki's picture

Hello, please can your say, where you find User_Cylinder.hxx to download it? I`m novice, and google can`t help me to find it.

Dmitrii Pasukhin's picture

Hello, you can find a patch. 0033750: Configuration - make file configuration failed in mfc example by lvsheng2022 · Pull Request #16 · Open-Cascade-SAS/OCCT (github.com)
Additionally,  OCCT team build Samples without root Cmake file. There are 2 option to build sample, see second: OCCT/samples/mfc/standard at master · Open-Cascade-SAS/OCCT (github.com)

Fixing current issue is planned, but I was waiting for reporter to sign CLA, but it takes long time, we will fix it from our side. My apologies.

Best regards, Dmitrii.

frankrun King's picture

Later, I modified the CMakeLists.txt of porject ImportExport like the picture bellow.
It seems work.
: )