c++ programs developed and compiled with visual studio
I have Visual c++ 2010 express installed. I develop some apps with it (mainly console based for now).
I usually compile via the cl.exe command line option. Does thes开发者_如何学Goe apps that I compiled with Visual C++ require .net framework to run?
Also what exactly is the object code file?
Lastly, I know that mono has Windows Form 2.0 fully implemented. Which version of the .NET framework corresponds to WinForm 2.0? (I'm guessing .NET 2.0?) Does this mean that I have to use Visual Studio 2005 to develop or can i create a new project with different .net version with Visual studio 2010?
Thanks
In order:
No, your apps will not require the .NET Framework as long as you stuck with pure C++ (i.e., avoided C++/CLI). If you linked to the C runtime library dynamically (/MD), however, your apps will require the "Microsoft Visual C++ 2010 Redistributable" to be installed.
Object code is an intermediate representation. Your source files have been compiled into x86 (or amd64) instructions, but still need to be linked together with runtime libraries before they can be used. Except in unusual circumstances, the .obj files are not considered part of the final app and do not need to be packaged.
Currently .NET Framework 2.0, 3.0, 3.5, and 4.0 correspond to WinForms 2.0. Since they largely share the same CLR, you do not have to use VS2005 to develop compatible applications as long as you stay away from newer functionality. Conveniently enough, Microsoft has halted development of WinForms, so just avoid WPF stuff and you'll be set.
Whether or not your application needs the .NET framework depends on how you compile. If you pass the /clr flag to the compiler, it will generate C++/CLI code, which does require (and allow you to use) the .NET framework.
Otherwise, you get a native C++ app, which doesn't require it.
If you want to use Winforms, which are part of .NET, you have to use the /clr flag.
As ChrisV mentioned, if you compile with /MD
or /MDd
, your program requires the VC++ runtime library. If you compile with /MT
or /MTd
, the runtime is statically linked into your app, so no separate .dll is required.
精彩评论