IncrediBuild to compile COM Clients with MSVC

We are suffering sporadic build errors when compiling a C++ file that uses a COM server’s TLB.

With MSVC, adding

#import "mycomserver.tlb"

to a C++ file triggers some weird black magic, that enables you to use the COM API from “mycomserver”, as if "mycomserver.tlb" would declare a regular C++ interface. Behind the scenes, files are being generated, e.g. mycomserver.tli. We are also aware, that this is a rather rare use case and is a MSVC proprietary feature.

We are getting the compiler error Cannot open include file: 'mycomserver.tli' from time to time. But since C++ compilation and mycomserver.tli generation are a single call to cl.exe, we have the impression, IncrediBuild might fail. I have also found addtional files named mycomserver_ib_0.tli - the ib in these file names also encouraged me to bring the issue to your attention.

I’d appreciate any experience made with that MSVC proprietary feature!

1 Like

I’m not sure if it’s relevant the problem but consider using no_registry attribute when importing tlb:
#import "mycomserver.tlb" no_registry
We used to have compilation errors due to mixed registered COM DLL version with an actual DLL. The attribute forces compiler to look for DLL in specified Include Directories.

1 Like

@Sasha Thank you for the hint, I modified our code accordingly, because it makes sense for us, even if it will not fix compile issues.

1 Like

Hey Robert,

Good catch on the “ib” file that was generated, as you mentioned there is a good chance the problem is with Incredibuild in this case. there were some cases prior to yours with the same exact issue that i found.

although each and every one of them was solved case by case i have few suggestions you can try -

  1. if you have an earlier version than 9.5.5 - you might want to try and upgrade since a tailor fix was made on that version for the same exact problem you’re currently experiencing.
  2. if you have a later version such as 9.5.9 you might want to try and add define NO_TLH_PROTECTION to Preprocessor Definitions (right click on appropriated project, Properties->Configuration Properties->C/C+±>Preprocessor->Preprocessor Definitions ).

let me know if any of them worked for you :slight_smile:
if not i suggest we open a ticket to dive deeper to your specific case!


We were still on 9.4.6 - but I am only offered an update to 9.5.0, nothing about more recent 9.5.5 or 9.5.9?

1 Like

No problem at all!
I’ll send you a link via email with the specific version and we’ll take it from there!

1 Like

I have upgraded to IB 9.5.9 ; so far, no more issues, I will continue monitoring - build errors are not reproducible. I have not yet tried out NO_TLH_PROTECTION , but will do so if I get errors again.