0

I have tree.idl file and generated a tree_map.h using MIDL compiler in CMAKE

getting this error C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\atlmfc\include\atlbase.h(2988) : error C2338: 'CAtlExeModuleT' must be used with neither _WINDLL nor _USRDLL defined

I have not added the defination of _WINDLL in my CMakeList.txt

Harshit
  • 1
  • 2
  • Have you tried to search? E.g. [thas question](https://stackoverflow.com/questions/46878906/invoke-midl-compiler-from-cmake) describes possible way for use MIDL compiler with CMake. – Tsyvarev Feb 27 '20 at 09:20
  • Yeah I have gone through this but since I have never used MIDL before can you please tell me what this line does set(MIDL_OUTPUT – Harshit Feb 27 '20 at 09:37
  • This line is a part of **multiline** command invocation. The end line of this command invocation contains `)` symbol. If you don't know what particular command means, see [CMake documentation](https://cmake.org/cmake/help/v3.16/manual/cmake-commands.7.html). – Tsyvarev Feb 27 '20 at 09:41
  • Oks. But want to confirm what this command does. it generates the output files IFace.h, GUIDS.c, Proxy.c, ProxyDll.c set(MIDL_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/IFace.h ${CMAKE_CURRENT_BINARY_DIR}/GUIDS.c ${CMAKE_CURRENT_BINARY_DIR}/Proxy.c ${CMAKE_CURRENT_BINARY_DIR}/ProxyDll.c ) – Harshit Feb 27 '20 at 09:44
  • Yes, custom command generates what is specified in its `OUTPUT` parameter. In the given case it is list of files specified in `MIDL_OUTPUT`. – Tsyvarev Feb 27 '20 at 09:47
  • can u please tell what this line COMMAND midl /h IFace.h /iid GUIDS.c /proxy Proxy.c /dlldata ProxyDll.c ${MIDL_FILE} does in add_custom_command? – Harshit Feb 27 '20 at 10:38
  • `COMMAND` denotes command line to be executed. As you can see, given command runs `midl` executable with corresponded arguments. If you want to know meaning of a specific argument, just read [documentation](https://learn.microsoft.com/en-us/windows/win32/midl/midl-command-line-reference). – Tsyvarev Feb 27 '20 at 11:14
  • Can you please help me with this error C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\atlmfc\include\atlbase.h(2988) : error C2338: 'CAtlExeModuleT' must be used with neither _WINDLL nor _USRDLL defined I have used remove_definitions( -D_WINDLL ) but still getting the same error @Tsyvarev – Harshit Feb 28 '20 at 09:26

0 Answers0