Are C++ CLI and C++ the same or different languages?

The bottom line is that I get errors when the standard C++ Windows libs, such as <windows.h> , etc., are TCHAR , I also cannot connect some types, for example TCHAR from <tchar.h> .

It may of course be somewhere, and my mistakes, but in general, how do I understand the compatibility of these languages ​​is sad?

  • > screw, such as #include \ n This is not "lib". This is a directive to include the contents of a file in another file. "liba" will be after it in quotes or angle brackets. - WhereColdWindsBlow
  • and what windows.h already in с++11 standard is? And under Linux how?) - pavel
  • @pavel, corrected the question. In general, it meant compatibility, universality of the usual c ++ and c ++ cli. - Align

1 answer 1

Yes, these are completely different languages.

C ++ / CLI, in addition to the "ordinary" C ++, also contains managed (.NET-) types, and the associated keywords gcnew , ref class and the like.


C ++ / CLI is a binding language needed for advanced scenarios using native and managed code. You shouldn’t write big projects on it. If you need computations in C ++, and UI in .NET, in my experience, the easiest way to present this is in the form of three modules: pure native computation, UI in C #, and binding code in C ++ / CLI. Well, or native calculations can be packaged in a piece with C ++ / CLI, if you do not want as many as three modules.


In terms of compatibility, native C ++ code that is compiled by MS Visual Studio should also be compiled under C ++ / CLI with minimal changes. Check that you have no managed header anywhere in your native code.

  • and how bad to write projects on it? I once wrote a term paper on it, it is convenient to connect libraries with C / C ++ and write via gcnew and so on. Can I have a little more detail on this moment? - pavel
  • So it was, there was a managed header in the native file, and it gives an error. - Align
  • @pavel: It turns out a completely awful syntax, well, some features (for example, out parameters) are simply not supported. The absence of async / await is particularly tragic. - VladD
  • @Align: Yeah, take him away, he has no place there. - VladD
  • @pavel, about Async Await, I fully agree with VladD, just look at how Chilkat developers, who write it to .NET under the .NET, had to pervert themselves: quiet horror ...: example-code.com/csharp/smtp_async.asp - Align ju