Frequently Asked Questions About Visual C++ .NET
Got a question about .NET? Check out the .NET FAQ!
Categories
- 64-bit Support
- C++ and .NET
- C++/CLI
- Devices
- General
- High-Performance Computing
- IDE
- ISO Conformance
- Language
- Libraries
- MFC
- Visual Studio Versions and Upgrades
64-bit Support
Is C++ fully supported for 64-bit platforms?
Yes! The freely downloadable Microsoft Platform SDK includes a pre-release compilerfor targeting the Intel Itanium.Visual C++ 2005 ("Whidbey") will include fully supported compilers for targeting bothAMD64 and Itanium. The mainstream 32-bit compiler will also generate managedcode that runs on the 64-bit .NET CLR.
What are the benefits of porting to a 64-bit platform?
Porting to a 64-bit platform gives your application several advantages. Thebiggest advantage, literally, is a much larger address space. In addition, bothAMD64 and Itanium have access to larger general purpose registers, and more of them. This usually means better performance. And by porting now, your applicationwill be one of the front-runners for the upcoming generation of computing!How can I learn more about porting my application to 64-bit?
Visit the 64-bitProgramming page on the MSDN Visual C++ Developer Center.Can I do inline assembly when targeting 64-bit platforms?
No. Unlike the mainstream 32-bit x86 compiler, the 64-bit compilers do not supportinline assembly.However, there are some alternatives for 64-bit applications. Compiler intrinsics are provided for almost every machine instruction. Assembly code may also be written in another file, assembled, and linked that with the C/C++ application.
C++ and .NET
What is "managed code", and do I have to use it?
Managed code runs within the context of the .NET common-language run-time environment(CLR). It is not compulsory to use managed code, but there are many advantagesto doing so. A managed code program written with C++, for example, canoperate with the CLR to provide services such as memory management, cross-languageintegration, code access security, and automatic lifetime control of objects.What are "Managed Extensions"?
Managed Extensions for Visual C++ are a syntax extension to the standard C++ language. These new keywords make it easy for new and existing applications to add support forthe .NET Framework.What is the "/clr" compiler option?
The /clr compiler option instructs Visual C++ to generate managed code that will runin the context of the Common Language Runtime (CLR).What is the .NET Framework?
The .NET Framework is a new computing platform designed to simplify application developmentin the highly distributed environment of the Internet. Software running on the .NETFramework can communicate with software running anywhere else through SOAP and canuse standard objects locally or distributed across the Internet. Consequently, thedeveloper experience is made consistent so that you can focus on features rather thanon plumbing. You can find out more at the .NETFramework FAQ.How does Visual C++ support Microsoft .NET?
Visual C++ enables developers to optionally incorporate the .NET Framework into theirapplications using the /clr compiler option.What can .NET do for my C++ application?
Enabling your C++ application with .NET technologies will allow you to leverage themany powerful features of the .NET Framework without rewriting your code. Theseinclude the Base Class Libraries, improved versioning and deployment, code and datasecurity, and a variety of other features. Adding .NET to your existing C++code is also the fastest and most cost effective way to leverage future WinFX capabilitiesfrom your existing applications. Incorporating the .NET Framework today is thebest way to prepare for Longhorn tomorrow.Can I recompile any application /clr?
Any application that compiles clean with the /TP compiler option (compile as C++ code)can be compiled with /clr. Not all source code will compile cleanly and mayrequire programmer attention to correct warnings and errors.In Visual C++ 2005 ("Whidbey"), the process of retargeting existing source code with/clr is made easier and more powerful, with less programmer attention required.
What are the performance implications of using managed code?
It depends. Purely managed code (no specific use of CLR data types) willgenerally run slower, but this is not always the case. For example, the CLR-targetedQuake II port runs approximately 5 to 15% slower on most platforms, but runs slightlyfaster on Intel Centrino Pentiums.Microsoft recommends that developers selectively retarget portions of their applicationsto the CLR where it makes sense, and to tune the managed/unmanaged boundaries whenand if performance issues arise.
Who actually uses C++ to target .NET in a real application?
Several companies with large C++ source-code investments are using Visual C++ to implementnew .NET-based features. Microsoft (DirectX), Riverdeep (PrintShop), and Autodesk(AutoCAD) are three companies who use Visual C++ to incorporate the .NET Framework,and enable their applications with .NET capabilities.How can I start taking advantage of .NET features without rewriting my application?
C++ has a complete roadmap for taking advantage of .NET Framework for C++ applications:- Compiling existing C++ code into MSIL – this allows you to take make use of any .NET classes such as .NET remoting, XML classes, etc. from your existing C++ application.
- Wrapping C++ native classes with managed wrappers which can be used by other .NET languages like C#/VB.
- Writing new .NET components that make use of existing C/C++ APIs as implementation.
- Writing new verifiable .NET components in C++ as in any other .NET languages.
C++ images can be pure native code, pure MSIL or mixed-mode containing both native and MSIL, allowing incremental migration to .NET
C++/CLI
What is the relationship between the new C++/CLI features of Visual C++ 2005 ("Whidbey") and Managed Extensions?
The C++/CLI features in Visual C++ "Whidbey" are an evolution of the Managed Extensionsfor Visual C++ .NET 2002 and 2003. CLR features are more tightly integratedwith existing C++ syntax and semantics, and provide a cohesive systems language formaking the most of the entire architecture.Why did the language need revision from V1 to V2?
Customer feedback directed the Visual C++ team to overhaul the original work withManaged Extensions to devise a more robust and more elegant syntax for Visual C++Whidbey.Devices
How does Visual C++ work with devices?
Visual C++ for Devices is the only Microsoft solution for developing nativeapplications on Windows CE devices.There is no official support for Visual C++ development for .NET applications using the Compact Frameworks. However, applications that you build using the /clr:safe option and that use only CLR and BCL features support by the Compact Frameworks will be able to run on CE devices.
General
Where can I find MASM?
In Visual C++ 6.0, Professional and Enterprise customers could get the Microsoft Assembler(MASM) by downloading VC++ 6.0 Processor Pack. Today MASM ships with VisualStudio .NET Professional and Enterprise as part of Visual C++. ML.EXE is locatedin the VC7\bin directory.Can I continue to write unmanaged applications with Visual C++ .NET?
Yes. Visual C++ .NET can generate both managed and unmanaged applications and components.Where can I find information on the SCC (source control) interface to Visual Studio?
VSIP Developer Community CenterRegister as a VSIP affiliate (free) and download the VSIP SDK Extra which has thenewest MSCCI interface in it.
Can I make my code run on both UNIX/Linux and Windows?
Absolutely, although this often means forgoing some of the great services providedby Windows and .NET developer platform, including Win32, MFC, the .NET Framework, DirectX, andinterop with Visual Basic and C#. An application using only pure ISO C++ functionality willgenerally be portable to any compiler and platform with an ISO C++ compliantcompiler.If I want to take advantage of .NET, why should I use C++?
Visual C++ allows you to take full advantage of .NET while at the same time givingyou the most efficient and easiest way to interoperate with existing code. Italso allows you to leverage your knowledge of C++ to .NET, rather than having to learna new language.What you get is the combination of a language you know and love, a great managed-unmanaged interop story, complete .NET support, and .NET features found ONLY with Visual C++ (such as IJW, OpenMP, and templates).
High-Performance Computing
What sort of high-performance computing options will Visual C++ "Whidbey" offer?
Visual C++ "Whidbey" will offers a variety of high performance computing functionality. Of particular note are the following features:- Full OpenMP 2.0 support. This will allow you to use the popular OpenMP API to write multithreaded programs, even incorporating .NET based programming.
- Debugging of parallel applications. Now you can debug MPI and other parallel programs with the debugger. It can automatically attach to jobs started on separate processes over multiple computers (or on the same one). Plus it adds the ability to set breakpoints and get variables, at process level granularity!
- 64-bit support. Visual C++ now offers full 64-bit support, to allow you to write applications not possible in the past.
- Profile guided optimization. This allows the compiler to generate the most optimized code for your program based on real-world profiles that are generated by scenarios you supply.
- New floating point model. With the new floating point model you can get a good combination of accuracy and precision, very consistent IEEE compatible results, or the fastest floating point code. We now give the user the flexibility to choose which would work best for their application.
IDE
What happened to ClassWizard?
ClassWizard has been replaced with several new wizards that individually provide morecontrol for adding member variables, message handlers, methods, properties, and events.My IntelliSense disappeared! What do I do?
Currently, some IntelliSense information is contained in the .ncb file. Sometimes this file becomes corrupted, which means that IntelliSense no longer works. Simply delete this file, which will trigger a reparse of your project to generatea new .ncb file.What happened to the browsing features of Visual C++ 6? I can't find them in Visual Studio .NET 2002.
Symbol browsing was moved to the 'Find Symbol' feature in Visual Studio .NET 2002.Inheritance browsing and caller / callee browsing is not available in Visual Studio.NET 2002.In Visual C++ "Whidbey", we're adding these features back. In addition, they willnow work without the need to create a BSC file or even compile your code.
How do I specify a different file extension for C++ files to be used by the editor and IntelliSense?
To get a file of a non-standard extension viewed as a C++ file in the VS editor:In VS .NET 2002, locate the registry key:
HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\7.0\Languages\FileExtensions
In VS .NET 2003, locate the registry key:
HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\7.1\Languages\FileExtensions
Search for the ".cpp" folder under "FileExtensions" and copy the value for the "(Default)" key.Add a new folder under "FileExtensions" for your desired extension and set the value of the "(Default)" key to the one you just copied.
To get C++ IntelliSense information on a file of a non-standard extension in the VS editor, you need to add the extension to the string in the following registry key:
For VS .NET 2002:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\7.0\Languages\Language Services\C/C++\NCB
Default C/C++ ExtensionsFor VS .NET 2003:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\7.1\Languages\Language Services\C/C++\NCB Default C/C++ Extensions
How do I copy resources from one project to another?
Open the .rc files in the editor using Open File (Ctrl-O). You can tile theeditor windows vertically and then drag and drop from one window to another. Alternately,you can create a new solution with both these projects and do the same operation throresource view window.Does Visual C++ take advantage of my SMP machine to compile faster?
In Visual C++ "Whidbey", the compiler and IDE will take advantage of SMP machinesto compiler faster.Will Visual C++ ever support Unicode resources?
Yes, we will support unicode resource files in Visual C++ "Whidbey". You will just have to save the .rc file as Unicode and set the Character Set property of the project.
ISO Conformance
Will Visual C++ implement the 'export' feature?
In general, Microsoft is committed to implementing the complete ISO C++ standard. However, Microsoft is particularly committed to delivering features that customersneed. As of yet, the demand for the export feature in Standard C++ has beenminimal. The complexity of the export feature is significant and customer feedbackhas shown that resources applied elsewhere now would solve more practical issues.Over time, we will continue to listen to customer requests and reevaluate whetherimplementing export is the best use of our resources.Language
What are the differences between templates and generics?
Check out this article for a complete answer:Libraries
What is ATL Server?
ATL Server is a new set of native C++ classes that allow developers to create high-performancenative code Web applications and XML Web services. Many of the classes can also beused in client applications or components that have a need for features such as performancemonitoring support, caching, and thread pooling.MFC
Do I need to rewrite my MFC application to take advantage of .NET?
Most MFC-based applications represent significant investments in development thatwould be thrown away if a rewrite to another language were undertaken. Microsoftrecommends that customers evaluate this cost against the much simpler route of extendingexisting MFC applications to take advantage of the .NET Framework. With relativelylittle work, an MFC application can be compiled wholly or partially to MSIL, and extendedwith new features using any variety of CLR languages, including C++ and C#.What is the future of MFC?
In Whidbey and beyond MFC remains a core feature of the professional Visual C++ toolkit. While MFC is not always the best or most modern library for writing new applications,it continues to offer features that are not available elsewhere. Microsoft willcontinue to maintain and extend MFC to make it more secure and robust, and to enableit to interoperate better with newer technologies and libraries. For example,new classes and features in Whidbey enable existing MFC applications to be extendedand augmented with capabilities built on the Microsoft .NET Framework.Will Microsoft continue to support and add features to MFC?
Microsoft has no plans to discontinue support for MFC. New features willin most cases enable MFC applications to better interoperate with the .NET Framework.What support does MFC offer for Windows Forms?
Currently there is no explicit library support for Windows Forms in MFC (Visual C++.NET 2002, 2003).Visual C++ Whidbey will support Windows Forms interop with MFC, through the introductionof new MFC classes. You will be able to do the following in an MFC application:
- Use Windows Forms as modal and modeless dialog box
- Use a Windows Forms Control as a child window or dialog box control
- Use Windows Forms Form/Control as an MFC CView, participating in command routing and updates.
MFC applications will be compiled easily with /clr compiler option and be able to take full advantage of the .NET Framework.
Can I recompile an MFC app /clr?
Yes, this is possible. It generally requires some work by the programmer, dueto known and documented issues with the compiler.Read:
Mixed DLL Loading Problem
Also, Microsoft Regional Director Kate Gregory has published a series of articles that discusses this topic:
Using Visual C++ .NET
In Visual C++ Whidbey it will be much easier to recompile a MFC application with /clr. While ANSI-codepage MFC applications can be complied with /clr, we advise you to convert to UNICODE, because all .NET Framework strings are UNICODE based, and interop with a UNICODE MFC application becomes much easier. MFC /clr applications will use the DLL version of MFC and not static library version.
Visual Studio Versions and Upgrades
Can I use Visual C++ 6.0 and Visual C++ .NET on the same computer?
Yes, you can install Visual C++ .NET on a computer that is running Visual C++ 6.0and use both, system requirements permitting. Different versions of Visual Studio.NET will also coexist nicely on a single machine.Where are the Professional and Enterprise versions of Microsoft Visual Basic .NET and Visual C++ .NET?
The functionality previously available in Professional and Enterprise versions ofthe individual language products is now available in the Professional and Enterpriseversions of Visual Studio .NET. In addition, a new Visual Studio .NET Enterprise ArchitectEdition is available with tools specifically designed for software architects buildingenterprise software, including Microsoft Visio Enterprise Architect Edition.What is the current version of Visual C++?
Visual C++ .NET 2003 is the current version. It ships as "Visual C++ .NET 2003Standard Edition", and with all editions of Visual Studio .NET 2003.This version was formerly codenamed "Everett".
What is "Whidbey"?
"Whidbey" is the code name for the next version of Visual C++. The "Whidbey" product will officially be named "Visual C++ 2005".
What is the next version of Visual C++?
The version following Visual C++ .NET 2003 will be "Visual C++ 2005", and is currently codenamed "Whidbey". Whidbey will include several new features that enable more powerful and more elegant development of .NET CLR-based applications. Additional features include support for developing 64-bit applications, and a new C-Runtime Library (CRT) that helps write more secure applications.
Does Visual C++ .NET work on Microsoft Windows 95, Windows 98, and Windows Millennium Edition (Windows Me) operating systems?
These platforms are not supported at design time (Visual Studio will not install on these platforms). However, programs may be built using Visual C++ that will run on Windows 98 and Windows ME.