What is the equivalent to WinAPI in Linux and macOS? [closed] - c++

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I want to create a cross-platform GUI library and I have experience in WinAPI for the window but concerning the other platforms like Linux and macOS, I want to know what is the equivalent to WinAPI(Win32Api) in Linux and macOS?

Every operating system has its own API. Linux API for Linux and Cocoa (API) for Apple's operating systems. Also see Portable Operating System Interface for POSIX compatible operating systems.

There is no direct equivalent. Win32 is a windows specific API. It has no equivalent in other operating systems. Well, it does have something equivalent, but the APIs are completely different.
You have to either use platform specific APIs on each system you support or use some cross-platform library (like Qt or similar) that will work across platforms and abstract away the platform differences for you.

Sadly there isn't any equivalent for WinAPI, but there are good alternatives.
I would recommend SDL 2. It has OpenGL and Vulkan support as well as it's own render functions. It supports Windows, MacOS, Linux, iOS, AppleTV and Android. You even can compile it on unofficially supported platforms. It also supports audio outputs. Also it has many add-ons that can be installed very easily.

Related

How to implement a file system for operating system development [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am using Xfce Ubuntu and building on GCC 10.2. I want to use FAT filesystem or EXT2 filesystem for my hobbyist operating system. I want a specific instruction and specific code for this question, and I am using C to develop my OS. I I want to list directories, make files, read files, and more in the OS. In addition, one is making an 32 bit Protected OS and I use my own kernel, which is not based on Linux or such. Means that I don't have any additional drivers or such. Please help me: how to can I use a filesystem in C (or C++, but I like C more than it) for my own OS?
How to implement a file system for operating system development
You first need to read a text book about operating systems.
You don't use a file system, you implement yours. For inspiration, look into Ext2, VFAT, XFS. Study their source code inside the Linux kernel source.
Of course, you'll need some compiler, so port GCC (as a cross-compiler) to your OS.
See also OSDEV and Linux From Scratch
Budget several years of full time development efforts.

Open a windows with OpenGL context [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have worked with SDL. I would like to know how I cound open the window with opengl context on windows
OpenGL on its own does not acknowledge the existence of the window, or any meaningful concept of a window. You need a windowing API. OpenGL will then have a rendering context passed to it by the windowing API.
<windows.h> is the WIN32 API for Windows, and the prototypical go-to API for creating windows when writing OpenGL applications for the first time on a WinOS computer. I don't know what the equivalents for MACOS and Linux are (X11, maybe?) but they have their own flavors.
For a wide variety of reasons (namely the fact that those APIs are old and arcane and obtuse to work with), there are a lot of APIs that wrap around the native Windowing API, and are much preferred for beginners. GLFW is one such example, and my personal preference, as it works out-of-box for Windows, Mac, and most Linux windowing APIs. SDL is another staple, though I get the sense it has fallen out of favor recently (it seems like it tries to do "too much" on its own).
I don't know the functionality of <glu.h>, but given that the whole thing is deprecated, I don't advise using it.

Is it possible to create GUI applications with c++ standard native library? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am interested in GUI application development, and when i search for it i found the only way ahead of me is to master in frameworks like qt, wxWidgets, gtk+, win32 etc. Win32 is ofcourse a native way, but it only run on win pc.
Why c++ standard native libraries does not provide APIs for GUI development?, just like like java.
It has every functions of its own to make a fully featured GUI app..?
Most platforms such as Windows, Mac OSX, Unix, Unix derivatives like Linux, and so forth, provide libraries of callable routines or objects which support GUI development on those platforms.
It might be nice to have a universal GUI library, but that would likely limit its features and aesthetics to a particular format and architecture which would necessarily have to exclude some of the most distinctive and useful features of the platform on which such applications would be used.
So one needs to select a platform for development and anticipate parallel development on alternative platforms. Sometimes aesthetics drives these decisions and sometimes capabilities and performance drives them.
Welcome to an endless adventure, good friend.
No.
GUI require graphics. C++ does not require a graphical environment. Unless you implement an OS yourself with graphics drivers etc in C++ you will not be able to do that.
And if you do, you will have re-invented the wheel (Win32).
Edit: As for java it is practically an OS.

Creating graphical programs using VC++ 2012 [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I would like to make a graphical application using Visual Studio 2010. I am trying to use C++ and have the app run natively on windows 7 straight out of an exe. Please give me some suggestions for what libraries to include as well as general concepts or a help document for it.
I know the question is broad, but I am only looking for broad answers.
Thanks
The "basement of everything" is the windows "hello world"
and all the windows API and related usage.
You can easily start from here.
If you are interested in other platforms, the equivalent base forn *nix (and linux-) derived systems are the X11 API.
There are then framework libraries that wrap both Windows or X API exposing a same consistent interface, like
WxWidget
GTK
Qt
FLTK
Nana
Some are easier, some more complete, some other even overkill.
But it's mostly all about taste.
VC++ provides Windows Forms for GUI development and GDI+ for 2D graphics, built-in and full-fledged. What more do you need ?

How to program frames in C++ [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
OK, C++ noob here asking a very nooby question (sorry) but whenever I write my basic programs (helloworld etc.) they always appear in a command prompt window. I want to make proper windows like in Word and other programs. I know it is possible to do this because of all the programs I use every day. But how do I do this in C++? For all the Java veterans out there, I want it to be like a JFrame, but the C++ equivalent.
C++ doesn't have a UI library out of the box, so you need to choose one.
Popular options would be MFC (under Windows/Visual C++) or Qt (with quite a lot additional libraries and features, working on many platforms).
Since you mention Word, it appears that you're on the Windows platform.
Then consider starting with e.g. the Lessons in Windows API Programming (C++) hands-on tutorial.
There are also a great many other tutorials on the net, and books to buy. I just picked the one that I was most familiar with, as the author. Regarding books, the classic book on programming the Windows API is Petzold's "Windows Programming", but I seem to recall that the latest version is for Windows 8 and in C# (earlier version were C/C++).
The tutorial leads you through how to get started with creating window programs using the Windows API (Application Program Interface) direcetly.
This is fairly language independent, but the language used in the tutorial is C++. C++ doesn't have standard library support for GUI stuff. The idea in C++ is that you're free to use whatever third party libraries that you want, or create them, such as the Windows API.
This is highly platform dependent. You can use a GUI cross-platform library, like QT, or use native mechanisms. Under Windows you can use the WinAPI and MFC.