简体   繁体   中英

Visual C++ Compilation

All of my commercial experience is based on high level languages like .NET (VB and C#). I have academic experience with C and C++ (university).

I don't full understand how Visual C++ fits into the .NET way. I have experience using Cygwin to compile c++ programs for Linux (at university).

Am I correct in stating that Visual C++ will compile into Intermediary language like C# and VB.NET? I assume that Visual C++ is used by developers that want to target Windows only and Cygwin is used by C++ developers who want to target multiple environments?

The reason I ask is because I am using a C++ component (written by another developer) as part of a .NET app.

I have read many Visual C++ articles online today but I have not yet found the answer I am looking for.

No. C++ is compiled directly to machine code, there is no intermediate step like .NET's IL with a just-in-time compiler to translate it to machine code at runtime.

If you have a need to interop between C++ and .NET code then you'll probably want to take a look at C++/CLI. A language that merely resembles C++ but is very good at bridging the gap between native C++ and the .NET runtime.

Am I correct in stating that Visual C++ will compile into Intermediary language like C# and VB.NET?

Yes and no. If you use C++/CLI (which is a Microsoft proprietary language included in Visual C++, similar to the C++ language but definitely not the same thing), then yes, it will compile to .NET intermediate code. If you turn off C++/CLI and use standard C++, then it will compile to native code and not use the .NET runtime.

Cygwin is used by C++ developers who want to target multiple environments?

Cygwin is not required if you want to target multiple environments. However, code written in a portable way that compiles with Cygwin is more likely to compile on GCC on other platforms too. You can write portable code with any compiler.

Cygwin to compile c++ programs for Linux

I think you might be a wee bit confused on this point. Cygwin is a package that provides a GCC compiler (and POSIX-like) environment for Windows . Cygwin does not run on Linux, there's no need.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM