简体   繁体   中英

Do I have to use “Visual” C++ in VS 2008?

I am new to Visual Studio 2008 (.NET Framework 3.5) and am Developing a Windows Form application.

Starting the IDE, the only options for a New Project are under the categories:

  • Visual Basic
  • Visual C#
  • Visual C++

I did Visual C++ -> CLR -> Windows Forms Application

However, the template code is in the "Visual C++" syntx.

How do I create a new GUI project with plain vanilla C/C++ using Visual Studio 2008?

Please note, the last time I did this was with MFC in Visual Studio C++ 6.0 If I am missing the underlying principal please explain.

Thank You!

Example: http://msdn.microsoft.com/en-us/library/ms235634%28v=vs.90%29.aspx

Long story short - you cannot.

Windows Forms is a .NET framework and not a C++ framework. This in turn means that you cannot use C++ to work with it. What Microsoft did is invented their own language that is C++-ish, but compiles into CLI bytecode (likely with native code mix-in, but I am not sure). Before it was "Managed C++", now it is C++/CLI (what you have linked as an example is not C++, but C++/CLI).

For plain C++ projects you have to choose "Win32 Project", "Win32 Console Application" or "Empty Project".. But then you cannot work with Windows Forms. Your options would be to use other GUI libraries like GTK , Qt , WxWidgets . There are tons of GUI frameworks. Or perhaps you would prefer sticking with Win32 API . My personal choice is Qt. And no Visual Studio at all.

Hope it clarifies things a bit for you. Good luck!

The "Visual" is just the name of the product. It's not a different language. c++/cli however, is a different language, and that's what you're seeing. If you want to make a Windows Form application, you will have to use .net. C++/cli is a .net language, C++ is not. You can make actual C++ applications with Visual C++, just not Windows Form applications.

First, there is no such thing as "Visual C++", in terms of a language . There is C++/CLI, which is a sort of variation of C++ that has extensions for building .NET libraries and programs using a C++-like language.

Windows Forms is a technology based on the CLR: common language runtime. AKA: .NET. You cannot build a Windows Forms application with just ISO C++. At some point, you have to talk to the CLR, which is at minimum going to require some COM support. And you'd probably be better off with C++/CLI and doing it that way.

Visual in this case means Windows Programming. And that include designing GUI (Graphical User Interface) for your application which will work in Windows environment. The language itself is C++.

You have two options available to develop Window Application.

  1. Use Window API's only
  2. Use a frame such as MFC,WPF etc

The language is always C++ but it has accommodation for Windows and therefore Visual C++.

Btw if you want plain C/C++, choose Visual C++ and start a console application. Make sure you select empty project.

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