Tutorial :C++ API for multiplatform development


I want to learn C++ to work on various platform (primarily, Linux and Windows). I have come across few solutions like the Boost C++ library, Qt toolkit, etc that can be used to write programs which will compile on both the platforms.

I want to know from the community, what type of library would you refer to use and if any of you had experience with this type of multi-platform programming before.


Use Qt and the BOOST C++ Libraries. They are both free and very high quality. Also, at least for me personally, I found Qt to be much more straightforward, easy to learn, and simpler than wxWidgets.


It depends on what you're going to do. If you need to write a strictly command-line utility to process text, Qt or wxWidgets might be inappropriate. What exactly is your application field?

Scientific computing is my field of expertise. in which these are great multi-platform APIs:

Parallel Programming

Numerical Algorithms

High-performance file I/O



You didn't specify any partuclar type of library, but if you just want a general recommendation I have to say wxWidgets is an excellent cross platform GUI library.

It has some great features like rendering the GUI in the native look and feel of the operating system it's running on, and is not particularly hard to learn. It offers a single API for GUI writing across Win/Mac/Linux, plus others like WinCE.

I highly recommend it for cross platform GUI work.

Check it out at http://www.wxwidgets.org/


I highly recommend Qt if you are doing any sort of GUI work; it's even quite useful if you aren't, since it has well-thought out networking/database/container/etc APIs also. It's a very well designed API and very easy to use.


The core C++ standard and the STL are pretty much cross platform already. Its usually only the GUI and hardware access stuff that requires libraries.

I have used GTK+ as a GUI toolkit and it's pretty good too, although you need to install glib and some other stuff on windows.

RtAudio is nice for cross-platform audio I/O.

The low level networking/sockets stuff is largely the same between windows and linux, you could write a very lightweight layer yourself to handle any differences. I don't have any experience with higher-level networking libraries.

I also like the SFML (simple fast media library) for cross-platform 2d graphics type stuff. It's very nice indeed.

I would suggest, however, that if you are just learning c++ then you're probably better off not looking at Boost (or indeed any of these toolkits) until you've got your head around the basics - by writing a couple of basic console applications, for example.

If you want to learn c++ only so you can do multi-platform dev, be aware that there are many other languages and associated toolkits that may be more suitable, depending on the app you're writing.

Without knowing the type of app you're planning on developing, its hard to say whether C++ (or C or Python or whatever) is the best idea. Personally, I generally turn to Python + PyGTK for crossplatform GUI apps and C# for windows-only apps. You can always plug C/C++ in to replace any components that are running too slowly.


Like other posters have mentioned, I would recommend Qt and Boost for cross-platform development. I had tried gtkmm which is a thin C++ wrapper around GTK+, but was not satisfied with it partly because it's not a native C++ library and documentation is poor compared to Qt. Besides that, Qt comes with very nice development environment including a easy-to-write make alternative qmake and a gui designer.


I for are going to do some cross platform development in C++ an you don't want to maintain different build systems (Makefiles, Visual Studio Projects, etc) there are several tools out there that can help you.

The one I personally use is CMake. It supports Linux and Unix Flavours, Windows and Mac/OS. Actually several open source projects, like KDE, use it. But there are others options like for instance Scons.


Standard C++ programs will compile and be portable, i.e. work across a large range of platforms. To be sure that you are keeping code clean, your best bet is to get a few different compiler and check your code with all of them, while enforcing full standard conformance (with options like -std= for g++, for example) and writing warning-free code (with options such as -W -Wall -Werror for g++, which emits errors instead of warnings). The exact choice of compilers is up to you, but if you're mostly learning, I advice using:

  • g++ (free, open source)
  • the Intel compiler (free for noncommercial use on Linux)
  • maybe MSVC++

Also, if you really have to use compiler- or target-specific code in your projects, be sure to abstract it so it's all gathered in one place, and hidden from the rest of your code.

Now, if you want to use more than the STL, then you need to choose your libraries by considering the range of compilers and platforms they're tested against (and, if the documentaiton doesn't state it, it's a bad omen). The detailled choice depends on what exactly you want to do, but Boost (as a robust, wide-ranging library for many common issues) and Qt (a recent version; for GUI programming) are good choices. For numerical, scientific programming, BLAS/LAPACK (and/or their parallel versions, BLACS and Scalapack) are very widely used, directly or through wrapper C++ classes as can be found in Boost (for BLAS); a good FFT library is also often needed (FFTW is good if its GPL licence is not a burden for you).

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »