Cannot open source file mscorlib.tlh

1.7k Views Asked by At

I am trying to import "mscorlib.tlb" inside my C++ project, but I keep getting this error:

cannot open source file "C:/Users/MyUsername/source/repos/DLL_Loader/.net compatibility/mscorlib.tlh

I am trying to import it this way:

#import "mscorlib.tlb"

just like MSDN suggests to do (https://learn.microsoft.com/it-it/dotnet/framework/interop/how-to-reference-net-types-from-com).

I am quite lost here, I never imported a .tlb file before, so I have no idea if I am missing some steps or something.

1

There are 1 best solutions below

4
On BEST ANSWER

Since C:/ is already the highest position in a Windows file system, C:/../ does most likely not go where you want to be.

It seems your include path is messed up and maybe you have to remove the C: to make it a relative path.