Linux "API" like WinAPI for GUI programming?

Hi guys,

currently I'm trying to create a free, open-source C++ framework to create platform-independent executables. I have to admit I'm not able to set up huge frameworks like wxWidgets or gtk+ on Code::Blocks, although I've followed the tutorials or instructions, it didn't work. Creating projects with Qt was fine, but it's only for free if the created software is open-source.

Now I'm thinking about recreating the GUI support from scratch, like granting WinAPI functions if the platform is Windows, the same for Linux or Mac, if possible. But I haven't found any good solutions or methods for Linux or Mac so far.
My question: Does anybody know if there is something like WinAPI for Linux? Or is there any framework out there that is compatible with CodeBlocks/MinGW and does not make it to complicated to compile?

Thanks for answers in advance.
Florian
Typically, Linux makes use of X11; https://stackoverflow.com/questions/12717138/what-is-linux-s-native-gui-api

As for a framework you can use so that you don't have to interact directly with X11 to create windows and so on, here's a list of widget toolkits:

https://en.wikipedia.org/wiki/List_of_widget_toolkits

As for lower level frameworks, SDL and SFML are popular.



Last edited on
Hello @Repeater and thanks for your answer.

I've already taken a look at that list some time ago, but I haven't been very successful so far. SFML was one of the first I've tried in combination with TGUI, but without any success. Sometimes I just think I'm too stupid to understand the tutorials... I've tried almost everything... Maybe I'll try something live TnFOX, CEGUI or Tk... but with every framework, I had to face problems with "unresolved externals" and had no idea how to build the libraries.

gtk+ and wxWidgets always had problems with includes or unresolved externals. With gtkmm, g++ complained about missing includes, which I forget to download from that web page. After all of them were included, g++ complained about syntax errors... That's why I really do not like to face with such huge frameworks again and why I want to try to code that from scratch by using the native APIs.

Qt was very nice, but as I understand, it's only for free if I use it open-source. Is that correct?

Florian
At risk of sounding patronising (tone is easy to misinterpret in a textual medium like this), it sounds like maybe you just don't quite know enough about how to program in C++ ("unresolved externals" and not understanding how to buildlibraries). There's more to it than memorising the syntax. Perhaps this might help; https://www.daniweb.com/programming/software-development/tutorials/466177/understanding-c-from-source-to-binaries

Last edited on
Qt is very nice, but yes, if you wish to use it to build something to sell they expect to see some money. (It used to be that you were required to know that up-front: you were expressly forbidden to develop with the free version and pay later; I think that requirement has been relaxed in recent versions but I am not sure.)

Development on Linux often requires you to be careful to install matching development packages (foo-devel), which are a separate rpm/yum/whatever command.


That said, if you want really a nice, cross-platform C++ development environment, check out Ultimate++:
https://www.ultimatepp.org/

Getting set up isn't all that painful, and it comes with a lot of libraries you need right out of the box.


(Developing a GUI library, on the other hand, is more grief than you think.)
The Windows API is an amalgamation of Kernel, User and GDI services. And encompasses other things too, LanManager, Active Directory, COM, DCOM, ... Further more, the Console functions are part of the the GUI.

In Unix, the Kernel is platform dependent. User space is standardized thru POSIX. Graphics are portable libraries, the most common of which is X, which itself has plugable components. Windows has no equivalent, the closest it has is Citrix.

So what in Windows is one big fat (convenient) library, a one stop shop for the whole platform, a Unix system is built from parts.

So, if you're really interested in portable graphics, look to a portable graphics library (SDL, SFML, Qt ...). From a Unix point of view, it doesn't make sense to port the GDI to Unix, because graphics processing isn't part of the OS. This thinking applies to pretty much all of Windows.
Last edited on
Thanks for all your answers. I've found a solution working for me.
Topic archived. No new replies allowed.