简体   繁体   English

Visual C ++编译

[英]Visual C++ Compilation

All of my commercial experience is based on high level languages like .NET (VB and C#). 我所有的商业经验都基于.NET(VB和C#)等高级语言。 I have academic experience with C and C++ (university). 我具有C和C ++(大学)的学术经验。

I don't full understand how Visual C++ fits into the .NET way. 我不完全了解Visual C ++如何适合.NET方式。 I have experience using Cygwin to compile c++ programs for Linux (at university). 我有使用Cygwin编译Linux上的c ++程序的经验(在大学里)。

Am I correct in stating that Visual C++ will compile into Intermediary language like C# and VB.NET? 我是否正确地说Visual C ++可以编译为C#和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? 我是否假定Visual C ++由仅用于Windows的开发人员使用,而Cygwin由C ++针对多个环境的开发人员使用?

The reason I ask is because I am using a C++ component (written by another developer) as part of a .NET app. 我问的原因是因为我将C ++组件(由其他开发人员编写)用作.NET应用程序的一部分。

I have read many Visual C++ articles online today but I have not yet found the answer I am looking for. 我今天在网上阅读了许多Visual C ++文章,但尚未找到所需的答案。

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. 不会。C++是直接编译为机器代码的,没有像.NET的IL那样的中间步骤,而只有即时编译器才能在运行时将其转换为机器代码。

If you have a need to interop between C++ and .NET code then you'll probably want to take a look at C++/CLI. 如果您需要在C ++和.NET代码之间进行互操作,那么您可能需要看一下C ++ / CLI。 A language that merely resembles C++ but is very good at bridging the gap between native C++ and the .NET runtime. 一种仅类似于 C ++但非常善于弥合本机C ++与.NET运行时之间的鸿沟的语言。

Am I correct in stating that Visual C++ will compile into Intermediary language like C# and VB.NET? 我是否正确地说Visual C ++可以编译为C#和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. 如果使用C ++ / CLI(这是Visual C ++中包含的Microsoft专有语言,类似于C ++语言,但绝对不是同一件事),那么可以,它将编译为.NET中间代码。 If you turn off C++/CLI and use standard C++, then it will compile to native code and not use the .NET runtime. 如果关闭C ++ / CLI并使用标准C ++,则它将编译为本机代码,而不使用.NET运行时。

Cygwin is used by C++ developers who want to target multiple environments? Cygwin由想要针对多个环境的C ++开发人员使用?

Cygwin is not required if you want to target multiple environments. 如果要定位多个环境,则不需要Cygwin。 However, code written in a portable way that compiles with Cygwin is more likely to compile on GCC on other platforms too. 但是,以Cygwin编译的可移植方式编写的代码也更有可能在其他平台的GCC上编译。 You can write portable code with any compiler. 您可以使用任何编译器编写可移植代码。

Cygwin to compile c++ programs for Linux Cygwin将为Linux编译C ++程序

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是一个软件包,为Windows提供了GCC编译器(和POSIX类似)环境。 Cygwin does not run on Linux, there's no need. Cygwin不在Linux上运行,没有必要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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