Friday, January 1, 2021

Error MIDL2311 statements outside library block are illegal in mktyplib compatability mode : [ ]

when I compile this project: convert MFC control to ActiveX demo, ran into this error:

Error MIDL2311 statements outside library block are illegal in mktyplib compatability mode : [ ] AxShadeButton C:\Demo_Temp\axshadebutton\AxShadeButton.odl 1

  1. Error MIDL2311 : statements outside library block are illegal in mktyplib compatability mode
  2. I tested this solution and it is working:

    How do you use windows 10 SDK with VS 2012? It is better to use VS 2015 with windows 10 SDK.

    I suggest you don't use /mktyplib203. Try go to project properties -> MIDL->MkTypeLib Compatible -> No.

    If you still get this error, it is better to post the part of your IDL code that causes the error here. If possible, please create a simple sample to reproduce this issue and post the reproduce steps here.

  3. Midl compiler error: 2214
  4. the last comment is good one:

    I was getting the same error when trying to compile an OCX project that was upgraded in VS2013. I had to open the .odl file and move the #include statements inside the library block.

  5. error MIDL2311 : statements outside library block are illegal in mktyplib compatability mode
  6. Creating an ActiveX Button from an MFC owner-draw Button
  7. CQuantizer
  8. Drawing Lines, Shapes, or Text on Bitmaps
  9. CxSkinButton

No comments:

Post a Comment