Gtk3 developing on windows - c++

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.

Related

c++ gui window cross platform

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/

Best alternative for Visual C++? VS11 Express can't be used to write desktop apps

Some of you might already know that Microsoft is trying to kill desktop development in favor of Metro style apps. The express editions of the new Visual Studio 11 will only support writing Metro style apps. They also won't give you the new compilers as part of the new Windows SDK. The only way to get the compilers is to buy Visual Studio Professional or higher.
Now it's time to find an alternative (alternative compilers for the Windows platform). Any suggestions?
Some links that are related to this issue:
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2645679-visual-studio-11-express-on-windows-7-and-the-abil
http://blogs.msdn.com/b/visualstudio/archive/2012/05/18/a-look-ahead-at-the-visual-studio-11-product-lineup-and-platform-support.aspx
http://www.microsoft.com/visualstudio/11/en-us/products/express
Gcc/G++ of course. In my opinion it is superior to VC++. In addition, you can use Eclipse CDT as IDE, it is quite usable at the moment (compared to older versions). I work like that on Windows. In addition, you can also work on Linux or MacOS without having to switch to another tool.
1) The Metro and WinRT features are accessible from C++/CX which in turn is built on top of COM, so according to this detailed discussion (SO question on WinRT and C) you can use the latest "Microsoft-only" features with any decent C compiler. Of couse this will require some code generation or just a lot of typing to get the access to basic facilities. I believe there would be a transition period and then the open-source community comes up with some automated solution to consume the WinRT APIs.
2) A quick list of available options right now.
Dev tools: MinGW or Cygwin (GCC toolchain + unix-like tools), Clang maybe, OpenWatcom as a thing from the past
GUI Libraries: FLTK, Qt, wxWidgets, Fox GUI toolkit, librocket (if you are into the OpenGL world)
IDEs: Code::Blocks, Eclipse+CDT, QtCreator
3) There's also a non-C++ way:
The FreePascal+Lazarus to allow Delphi-like RAD
Mono/SharpDevelop
Both options can use C++ code with some bindings.
4) Conclusions
These are the alternatives which give similar results but not always the similar level of comfort.
Yet another possibility would be Qt Creator, which comes with a full toolset targeting Windows (as well as MacOS, Linux, and Symbian). It is definitely somewhat different from VS, so it takes some getting used to, but overall I'd rate it as pretty decent. Qt (the library) generates somewhat mixed feelings -- some dislike its oddities (E.g., MOC), but quite a few consider it the best designed GUI toolkit available.
Don't forget the Netbeans GUI which is also available for windoze. It works great, just install mingw and choose this mingw/bin directory for the compiler tools and mysys/bin/make.exe as the make program
to download
https://netbeans.org/downloads/index.html
they have this plugin for vc++
http://plugins.netbeans.org/plugin/42519/vcc4n-visual-c-compiler-for-netbeans
some install info
https://netbeans.org/community/magazine/html/03/c++/
Another IDE that I havent used but looks good is
http://www.codeblocks.org/

multiplatform IDE for developing graphical interfaces in C++

I want to start making graphical user interfaces in C++ in some IDE, easy to learn and have enough documentation and examples. Besides being multiplatform, ie the final application can be run on both Linux and Windows
Some suggestions or experiences?
I would recommend Qt Creator.
The Qt libraries are multiplatform, cover a wide range of features and are well documented; the IDE too runs almost everywhere, is really easy to set up and is very well integrated with the library.
Other open source alternatives may be the wxWidgets with e.g. CodeBlocks, but in my opinion they aren't as good (in terms of completeness and documentation), and you don't have such a good integration with the IDE (also, in my experience setting up wxWidgets development on Windows needs some work).
You can use Eclipse which is open source and works well on Linux/Windows . There is descent documentation available as well..

porting wxwidgets opengl application to not library dependent application

I want to port wxwidgets opengl application that will be not library dependent.I want at least that it can be compiled without additonal libraries. I am thinking to port it to MFC or maybe WIN32.What is the most easiest?Maybe you have some other suggestion?
MFC is by far the easiest. It's also the only realistic option if you don't want to use libraries that aren't installed with Visual Studio.
You do realize, that MFC is just another library and works much like wxWidgets. The only difference is, that MFC ships with Visual C++. However if you were to compile with GCC (MinGW), then you'd have to obtain MFC somehow.
Also the whole boilerplate code for event handling and the like is rather prone to write. I say: Stick with wxWidgets, it's cross plattform, well supported and if you're scared by installing and using libraries, then you should not do programming.
Although one answer is already checked, taking the question the way it was worded, the answer is wrong. MFC is just an other dependency, although shipped with Visual Studio. You still need to ensure that the correct version is installed on the users system. The only real way to solve this problem is to go Win32 with WGL. Then you depend on nothing but OS libraries. (You probably still need to install the vcredist package though...)

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.