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?

frankrun King's picture

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