使用CMake生成MFC项目的时候,需要用到在共享DLL中使用 MFC,需要在CMakeLists文件中加上如下的代码:

ADD_DEFINITIONS(-D_AFXDLL)
SET(CMAKE_MFC_FLAG 2)
ADD_EXECUTABLE(detect WIN32 ${DIR_SRCS})

 

CMAKE_MFC_FLAG参数的意思是这样解释的:

To use MFC, the CMAKE_MFC_FLAG variable must be set as follows:

0: Use Standard Windows Libraries
1: Use MFC in a Static Library
2: Use MFC in a Shared DLL

相关文章:

  • 2021-12-06
  • 2022-02-24
  • 2021-11-14
  • 2021-05-17
  • 2021-09-23
  • 2021-12-03
  • 2022-02-19
  • 2021-12-21
猜你喜欢
  • 2022-12-23
  • 2021-10-05
  • 2021-09-28
  • 2022-12-23
  • 2022-01-15
  • 2021-06-28
  • 2021-10-25
相关资源
相似解决方案