1

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

T.T.T.
  • 33,367
  • 47
  • 130
  • 168
  • How do you hope to do a Windows Forms app in C++ but not Visual C++? – Andrew Barber Jan 25 '12 at 02:13
  • no clue, the last time I did it was with MFC in Visual Studio C++ 6.0, guessing this is the standard? – T.T.T. Jan 25 '12 at 02:15
  • Have you tried Managed c++? This might be relevant http://stackoverflow.com/questions/1189084/whats-the-c-gui-building-option-with-the-easiest-learning-curve-vs-qt-wxwid – DotNetUser Jan 25 '12 at 02:21
  • @DotNetUser: Managed C++ is no more. It is C++/CLI these days. Tho I don't really know what the hell has changed there. –  Jan 25 '12 at 02:26

4 Answers4

5

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!

  • Thanks for the in depth explanation, that does clear up what I was missing, will check out all the links, thank you. – T.T.T. Jan 25 '12 at 02:35
  • @Tommy: Also, you mentioned that you worked with MFC in the past. It's still around and still a perfectly viable option. The MFC libraries are just not included with the Express version, presumably to drive people towards Windows Forms. If you obtain the Professional version of Visual Studio, you'll get the latest and greatest version of the MFC libraries. – Cody Gray - on strike Jan 25 '12 at 03:12
  • You might be interested in [C++ Builder](http://www.embarcadero.com/products/cbuilder) - natively compiled C++, but gives you a WinForms-like (it's better) form designer and UI framework called the VCL. You can also use MFC with it, although no-one does since the VCL is sweet. It also has a cross-platform UI framework called FireMonkey, again with a visual designer etc, and cross-platform compiler so you can make apps that will compile to both Windows and OSX if you want. Hard to beat that! – David Jan 25 '12 at 11:05
2

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.

Benjamin Lindley
  • 101,917
  • 9
  • 204
  • 274
2

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.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
1

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.

TheTechGuy
  • 16,560
  • 16
  • 115
  • 136
  • yes you cannot create GUI with console application. Writing Windows Program is a whole different animal. You do not have to get deep into it if you are using a framework such as MFC etc. In Windows programming, you have to use a lot of Windows API. It is still C++ by all means though. It is just working with something that is different far more complicated than DOS. – TheTechGuy Jan 25 '12 at 02:40