c++ gui window cross platform - c++

I would like to make c++ that will work both on Linux and windows as I understand if I use the win32 template in visual studio then it will only work on windows is there something built into c++ like java's jframe that I can use. Also I would like to use any external library at this time.

Here are some cross platform alternatives QT, wxWidgets, Ultimate++. I have used QT, it is intuitive with a huge collection of tools to use in your code. The others are also popular but I have never used them.

I make used of wxWidgets due to it's cross platform and even cross architecture, native look on the OS where it appear. Binary application yields by wxWidgets is small enough thus make it possible to linking statically as portable application. Qt produce huge binary if linked statically (and may be violate qt licensing scheme).
Another reason are licensing flexibly, well documentation and supported by huge community arround the world. wx is considered as mature framework since it first release about 20yrs ago. It's use standard C++ syntax and preprocessor that will make you easily switch from plain C or C++. Complete library are available ranging from appeal window GUI, string, network, stream, webview, xml, and wx is playing very well with 3rd party library as such database SOCI, Asio, etc ....
You may try start to code with wxWidgets easily using Eclipse-IDE and wxFormBuilder as GUI designer. Plese check my experience for ease setup it's IDE+Toolchain. This wx installer can be used do develop, test and run wx application on Linux desktop, and then deploy the binary on Raspberry Pi is available for another board target beside Linux x86_64.
http://yasriady.blogspot.co.id/2016/01/raspberry-pi-toolchain.html

There is a cross-platform application & UI development framework called Qt. I think it meets your requirements. Click here for more info.

There is a long list of both active and dead cross-platform C++ UI libraries here: https://philippegroarke.com/posts/2018/c++_ui_solutions/

Related

Is it possible to create a C++ GUI with Visual Studio?

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.
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.
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.
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++.
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.
OK, the point is that qt 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.

Gtk3 developing on windows

I am new (relatively) to C++ and to SO.
Having stretched the creativity of console applications to the limit, my very rabid mind wants to know how to code GUIs now. I did some research, decided to use GTK rather than Qt because of having freedom of choice, there being no strings attached and something about slow internet and having to download some 0.6GB were I to go with Qt.
It has been a brutal 48 hours trying to build 'Hello World' on Gtk. This is me throwing a tantrum. I'm using Visual Studio 2010. Perhaps this is the source of all my woes. It seems Gtk is meant for C and not C++. After solving issues with header files includes and a certain notorious glibconfig.h missing (which I downloaded from the internet only to find, to my horror,that it is supposed to be a generated file), the compiler threw syntax errors,especially in one gatomic.h.
I suspect 10 errors will come up for every one I manage to solve. This is where you come in. Do you use Gtk to develop c++? If not, why so? What would you recommend instead? Do you use Gtk on windows? How is that possible? Please give details.
Is it possible to make cross-platform apps that use C++ code and a Python/VB GUI?
Your answer will be sincerely appreciated.
First off, a general note: Gtk being mainly developed as a toolkit for Gnome, I think it is fair to say that the main focus is high quality on Linux while other platforms are somewhat second-class citizens. This is probably most visible by looking at the integration with the native look and feel of Windows and MacOS. If you are looking for a toolkit which behaves equally well on all major platforms, I'd recommend you reconsidered Qt.
As far as your more specific questions are concerned:
C/C++
Gtk is written in C, and consequently has a C API. If you are looking for a C++ API, look at the Gtkmm bindings. Note that you can also use the C API in a C++ application.
glibconfig.h
I don't know whether you tried compiling Gtk yourself, but the easiest way to get Gtk3 for windows is by downloading the precompiled all-in-one bundle from http://www.gtk.org/download/win32.php (which includes the glibconfig.h you are missing).
When and how to use Gtk and with what language
As pointed out above, the primary users oft Gtk are people who develop applications for the Gnome desktop environment. Most cross-platform applications nowadays however use Qt since the quality on Windows and MacOS is higher compared to Gtk on those platforms.
Concerning what langauge to use, a strength of Gtk is that there exists bindings for many languages (including C++ and Python), so you are certainly not confined to C.
When developing with C++, something that I personally like about Gtkmm is that it uses the standard library, as opposed to Qt which has it's own implementations for data structures etc (the reason being that Qt predates the times when the STL was generally available and usable on all main platforms).
How to use Gtk: contrary to Qt which has the excellent Qt Creator, Gtk is somewhat lacking a specifically designed IDE for easy development. The closes you'll get is using Glade for interface design and a text editor or IDE of your choice for the coding, but that choice will differ depending on the platform you are on. Clearly, as you probably noticed, integrating Gtk into the environment of choice usually requires some work (and also some more technical knowledge). So again, if you are looking for an easy to set-up and use environment for developing GUI applications, I'd just go with Qt and Qt Creator.
Cross-Platform apps
First off, Visual Basic is not cross-platform. But generally speaking, there are plenty of possibilities for doing cross-application development, using various languages.
I've had to get a gtk3 project working on windows a few months ago, when gtk3 just came out for windows. I've had problems compiling it under Visual Studio as well, and posted a question here, specifically this one.
Here's how I got it working on windows:
Download the all-in-one bundle for Windows from gtk.org
Install, etc, set up include/link dirs within the project. (personally, I dumped gtk's folders in the project folder, pointed at "include" as an include dir and "lib" as a link dir, then proceeded to move any files/folders the compiler cannot find around to the root of "include" )
If not set up automatically, add include and link dirs as necessary until the compiler finds all the files.
If using MinGW to compile, it will succeed at that point.
If using Visual Studio, you have to modify gtk headers as described in the gtk mailing list:
In gutils.h lines 82 and 122, and in gstring.h line 129, change
"static inline" to "static __inline".
Blockquote
Note that the modification does not impact MinGW's ability to compile.
I have successfully compiled my gtk3 project on both windows (with either Visual Studio or Code::Blocks) and linux without writing platform-specific code that way. Just don't forget to include the required runtime dlls with the program when you ship it.

Alternate of win32 framework for windowing system on windows

I want to develop a custom window system in c++ that should not depend on win32 library. As an example, Google Chrome has an interface that is not similar to windows own interface. Similarly MPCstar and adobe products have their own interfaces. Please help me where to start for such a project?
You can use cross platform
Qt
or
wxWidgets
but in my opinion Qt is better.
Qt is awesome even if you don't need cross platform support. I assure you after using it you won't understand how anyone could ever develop native GUI on frameworks like Win32 and MFC. Its only shortcoming is the size of the DLLs you'll have to distribute with your app.
BTW is C++ a prerequisite? if not, and you only need windows, use .Net.
I believe Qt should do the trick. I've never used it myself but it is platform independent. I know a few applications that use it, and it seems fine.
Qt and WxWidgets are the better options. And since its GUI I think Qt performs better and has greater support and lots of libraries.
Find Qt here!

want to make a complex c++ gui simply

I want to make a nice simple gui using c++. which have drag and drop capabilities, must be light weight. Im thinking of a gui like utorrent client gui.Its light weight and simple.
please give me information about most easy to use libraries / ide /plugin (on windows platform may be good).
Either use QT or wxWidgets. Both are free to use, but QT uses more advanced features of C++ and is used slightly more than wxWidgets (From what I have seen) and has the backing of Nokia.
Both have various gui editors. QT has a QT Creator and there is a list of tools on the wxWiki, which includes a lot of open source RAD gui designers.
I have experience of using wxWidgets in both C++ and Python, and would recommend wxFormBuilder as a GUI designer.
The downside to both is they feel the need to use their own string classes etc which duplicates the functionality of the stl. From what I understand is that this is because when the projects were started there wasn't a standard.
Qt seems to be the most natural choice for your requirements. It has a complete SDK which includes a GUI builder (Qt Designer), an IDE (Qt Creator), internationalization tools and comprehensive documentation. It can also be integrated with such IDEs as Eclipse and MSVS.
In addition to GUI libraries, it has lots of utility classes including containers, facilities for working with file system, processes, XML-data and databases, etc. So you can write the code only once and it will work on every platform supported by Qt, you'll just need to recompile it.
If it seems a little too stodgy at first glance, you may rebuild the Qt libraries from source to include only those modules you actually need.
P.S. I wouldn't suggest using MFC. It's just doesn't worth the effort when you have a more friendly and easy-to-grasp choice.
I would go with QT.
Some of the PROs:
Free as in "free beer"
Free as in "free speech"
Multiplatform (Windows, Linux, Mac OS)
Natively written in C++
Easy to use
In my opinion, some of the CONs:
If you are only targeting Windows platform, you might get better looking (and faster?) UIs with MFC (Microsoft Foundation Classes)
Yet another vote for Qt. I am using it since about 8 years for now (EDA branch) and it works out very good.

Cross-Platform Objective-C / C++ Development

I work in a team of developers, one of us works specifically under Windows, and I work primarily in Mac OS X. We're wanting to develop C-based applications either in C++ or Objective-C however I'm not really knowledgeable in how to go about a cross-platform development project.
Is it viable to work in C++ using Mac OS X? Obviously they're geared towards Objective-C but is there just as much support for C++. What about cross-platform development in these languages? I'd use something like boost and some kind of UI library.
Has anyone got any experience in developing for multiple platforms yet allow applications to run natively without the need for a VM?
EDIT: There's a lot of answers I want to mark as correct now. It seems like Qt is the way to go and develop it in C++. Chances are this will be for *nix, OS X and Windows so that would be the best option for us personally. If I can avoid writing Objective-C so the team sticks to C++ then all the better. If I have to write the GUI in Objective-C and mix and match then that's not too much bother either.
I work for a software company that produces software for Mac OS X and Windows using C++, MFC, and Objective-C.
Yes, it is definitely possible.
You probably will be best served if you develop the "core" of the application in C++. In a MVC application, the C++ part would be the model, and possibly the controllers. For the code that interfaces to the GUI and other OS-specific interfaces, you should use the native APIs: Objective-C on Mac OS X and C# on Windows XP.
The good thing about the Mac is that you can compile C++ and Objective-C together. You can even have Objective-C++ where C++ and Objective-C are compiled in the same compilation unit. Unfortunately you cannot do this with C# (there is something called Managed C++ which is a different beast).
I would avoid cross-platform frameworks such as Qt and wxWidgets. They both allow you to develop cross-platform applications, but the look and feel of such applications is sub-par. I have more familiarity with wxWidgets though, its design is heavily geared towards the Windows MFC paradigm of application design.
Edit May 14, 2009, 9:44 AM EST: If Qt now allows true look and feel of the native platform, it could be a good option. I haven't looked at the latest offering so you may want to look at that framework before designing your own. That decision should be made after examining the results of the applications and how comfortable you are with the design paradigms that Qt requires.
You could look at Qt. I've used it successfully on Windows, Linux and Mac OSX projects.
what I use, is have a common library written in C or C++ with all the core functionality of your application.
Let's say you are building a solitaire game. So you will have core classes in a pure C++ (mostly platform independent) library.
CoreSolitaire
Then, you will have separate UI projects, one for each platform you want to deploy your solitaire on:
iSolitaire (Objective-C, MultiTouch Cocoa Based for iPhoneOS)
MacSolitaire (Objective-C, Cocoa Based for Mac OS X)
WinSolitaire (C++, Win32 or C# Based for Windows plaforms)
GSolitaire (C++, GNome/GTK based for linux/unix)
It's more work, but, in my opinion, the resulting product is definitely better than one you could get by using a platform independent widget set like QT or wxWidgets.
Having said this, if you are going to deploy your product internally in a company where you have full control of the deployment environment, and you don't care that much about how the resulting product will behave on different platforms, you could definitely use a common API for everything (QT, wxWidgets, or any other you might encounter).
Is it viable to work in C++ using Mac OS X? Obviously they're geared towards Objective-C but is there just as much support for C++.
Yes, there is.
You can do pretty much anything you want with C++ in OS X --anything that you could do with C++ on Linux, for example. There is support for the gcc's C++ compiler, c++ libraries, et all. Xcode provides support for working with C++.
You can even mix c++ with objective-C with Objective-C++ (Note, however, that this is not portable for GUI work).
What about cross-platform development in these languages? I'd use something like boost and some kind of UI library.
I believe that your best bet is QT.
It is a stable C++ library that is cross-platform (Windows, OSX, Linux and more), has been around for over a decade, is well supported, with many commercial apps written in it (Skype, Adobe Photoshop Album) and a ton of open source stuff written with it (the KDE desktop for starters). Besides GUI stuff it provides a whole lot more (container classes, xml, database connectivity, etc).
You can develop both Open Source and proprietary (closed source) apps for free with the latest QT, and the library was recently bought by NOKIA, a huge multinational, so it isn't going away any time soon.
Besides the library, QT also comes with an IDE and a Visual Forms Designer (all for free).
Other cross-platform GUI libraries for C++ also exist for OS X (wxWidgets, gtkmm, et al).
Has anyone got any experience in
developing for multiple platforms yet
allow applications to run natively
without the need for a VM?
Slightly. Make sure that you wrap around all the platform specific code.
That way you're main application or library doesn't need to reference the platform specific code. That should make it alot easier when porting to another platform.