midl

Getting MIDL 2003 Redefinition errors

偶尔善良 提交于 2021-02-10 15:39:43
问题 I have a very simple program that I am trying to compile before I build it out any further. I am trying to learn COM so following along here, I create app.h and app.cpp file in VS 2017 and using the ATL Template. When I try to build the solution I get a lot of MIDL 200 redefinition errors. UPDATE (Based on @Roman R.'s response) Note that if I used cl /LD app.cpp on a Dev Command Line, I am able to generate app.dll correctly. The MIDL 2003 redefinition errors show up only when trying to build

Getting MIDL 2003 Redefinition errors

风流意气都作罢 提交于 2021-02-10 15:39:14
问题 I have a very simple program that I am trying to compile before I build it out any further. I am trying to learn COM so following along here, I create app.h and app.cpp file in VS 2017 and using the ATL Template. When I try to build the solution I get a lot of MIDL 200 redefinition errors. UPDATE (Based on @Roman R.'s response) Note that if I used cl /LD app.cpp on a Dev Command Line, I am able to generate app.dll correctly. The MIDL 2003 redefinition errors show up only when trying to build

Upgrading VS2017 from 15.4.1 to 15.5.1 resulted in build error

混江龙づ霸主 提交于 2021-02-04 17:09:17
问题 I'm programming with the following tools/versions: Windows 10 / VS2017 Professional / C++ After I upgraded to 15.5.1 I got the following error: MIDL2338: switches are contradictory - no_robust vs. - target The Microsoft compiler error description list says: You cannot use both the /osf and /ms_ext command-line switches when you compile an IDL file. None of those switches are specified in my project properties. I tried to downgrade back to 15.4.1 but have found that it's impossible to revert

Invoke MIDL compiler from CMAKE

拟墨画扇 提交于 2020-11-28 01:54:27
问题 I am going to use MIDL compiler with CMAKE but unable to invoke MIDL compiler from CmakeList That is command which I use to achieve my goal add_custom_command( 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 COMMAND midl /h IFace.h /iid GUIDS.c /proxy Proxy.c /dlldata ProxyDll.c ${CMAKE_CURRENT_LIST_DIR}/include/Server.idl ) When I build my project there are no files produced by MIDL

Any way to resolve C4772 errors without having to register DLLs?

余生长醉 提交于 2020-01-14 19:10:45
问题 I am maintaining a VS2010 project which has a number of cross-referenced COM libraries. I am trying to configure the project in such a way that it is buildable from a random workstation which has VS2010 installed. The workstation could be both 32 and 64 bit, so if I configure project to "register output", the build will fail to build on 32-bit machine, since 64-bit DLL will not be possible to load to call DllRegisterServer. Here is an example: Typelib from project B references typelib from

Any way to resolve C4772 errors without having to register DLLs?

冷暖自知 提交于 2020-01-14 19:09:48
问题 I am maintaining a VS2010 project which has a number of cross-referenced COM libraries. I am trying to configure the project in such a way that it is buildable from a random workstation which has VS2010 installed. The workstation could be both 32 and 64 bit, so if I configure project to "register output", the build will fail to build on 32-bit machine, since 64-bit DLL will not be possible to load to call DllRegisterServer. Here is an example: Typelib from project B references typelib from

Any way to resolve C4772 errors without having to register DLLs?

醉酒当歌 提交于 2020-01-14 19:07:26
问题 I am maintaining a VS2010 project which has a number of cross-referenced COM libraries. I am trying to configure the project in such a way that it is buildable from a random workstation which has VS2010 installed. The workstation could be both 32 and 64 bit, so if I configure project to "register output", the build will fail to build on 32-bit machine, since 64-bit DLL will not be possible to load to call DllRegisterServer. Here is an example: Typelib from project B references typelib from

How to use midlrt.exe to compile .idl to .winmd?

爷,独闯天下 提交于 2020-01-14 04:12:26
问题 Background: I need to build a Windows Runtime Component as part of a system that's set up to use CMake to generate its build system. As a preparatory step I'm trying to build it on the command line. Starting with a bare-bones .idl file (MyType.idl) namespace NS { [default_interface] runtimeclass MyType { } } I'm trying to generate a matching .winmd file using the midlrt.exe tool. The following command line (split across several lines for readability) midlrt /metadata_dir "%WindowsSdkDir

MIDL generates the same file for /env win32 and /env win64

社会主义新天地 提交于 2020-01-02 04:54:05
问题 In Visual Studio, when you compile foo.idl, MIDL generates the proxy information in foo_p.c. Unfortunately, for Win32 and x64 files, it uses the same filename. For Win32, the file starts with: #if !defined(_M_IA64) && !defined(_M_AMD64) For x64, the file starts with: #if defined(_M_AMD64) When you build for Win32 and then immediately build for x64, it doesn't replace the foo_p.c file, meaning that the project fails to link. I tried having a pre-build event that deletes the foo_p.c file if it

How do I declare an IStream in idl so visual studio maps it to s.w.interop.comtypes?

狂风中的少年 提交于 2019-12-30 12:20:31
问题 I have a COM object that takes needs to take a stream from a C# client and processes it. It would appear that I should use IStream. So I write my idl like below. Then I use MIDL to compile to a tlb, and compile up my solution, register it, and then add a reference to my library to a C# project. Visual Studio creates an IStream definition in my own library. How can I stop it from doing that, and get it to use the COMTypes IStream? It seems there would be one of 3 answers: add some import to