12

Can we create C++ GUI applications with Visual Studio or do we need QT like cross platform softwares?

(By the way, I am assuming if I create a GUI with C++ it would be a cross platform application because as far as I know C++ is a cross platform language)

For some of you maybe this is a very obvious question but I couldn't figure out.

Zgrkpnr
  • 1,191
  • 4
  • 15
  • 32
  • 1
    The Windows API can be used with *any* C or C++ compiler that works on Windows. If you get the paid version of Visual Studio it comes with MFC, which is Microsoft's C++ GUI library, and a resource editor that makes laying out dialogs much easier. MFC and the resource files are definitely *not* cross platform. – Mark Ransom Apr 02 '14 at 21:09

5 Answers5

13

The C++ language is cross-platform, but its standard libraries don't provide anything specifically for any GUI development. For that, you need a C++ GUI framework/library. Qt happens to provide just that and it's also cross-platform.

So no, without the use of some cross-platform GUI framework, your application not only won't be cross platform, it simply won't have a GUI at all, since C++ standard libraries don't provide this functionality.

If you use one of the GUI frameworks available only for Windows, like MFC or Windows Runtime, you're not cross-platform.

Aykhan Hagverdili
  • 28,141
  • 6
  • 41
  • 93
Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313
6

There are no GUI libraries built directly into c++. Therefore, any GUI you built using c++ would not be cross-platform. There are a couple GUI libraries that come with Visual Studio - MFC and ATL are both fairly common. Neither are cross-platform, however. That doesn't stop you from using some other GUI framework, of course, if you include it. There are plenty to choose from, including ones that are cross-platform.

Just because a language is system-independent, doesn't mean people haven't written frameworks for it that aren't system-independent.

neminem
  • 2,658
  • 5
  • 27
  • 36
5

C++ has no standard, built-in GUI library. If you want to make cross-platform GUIs you must use an add-on library like C++, GTKmm, wx, etc.

If you're OK with targeting Windows only, MFC exists and is included with Visual C++.

nobody
  • 19,814
  • 17
  • 56
  • 77
1

If You want multi platform application, You should concern using Qt. It makes multi platform development easier by providing API for handling both Windows and Linux (and others). You can use Qt in Visual Studio easily. And is really easy to learn. Check official Qt docs for integration tips.

markubik
  • 646
  • 4
  • 9
1

OK, the point is that claims (and prooves) to be platform independent. It shouldn't matter at least if you compile it on a windows platform using either the MinGw GCC or MSVC toolchain.

The difference is, if you use Visual Studio's integrated GUI support, you'll end up with their proprietary, non portable CLR/CLI implementations, and the code won't be portable for other platforms.

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190