Hi guys ! I'm using linux OS, and i have gcc compiler in it defaultly. But i can't compile advanced programs which include "windows.h" in it. Can you please provide free download's link for such compiler?
You won't be able to compile anything with the "windows.h" header in it (or the related "stdafx.h" header) for Linux with any compiler, as that is a Windows-specific header.
If you need to run a Windows program under Linux, you'll need to use WINE and a Windows compiler, and run both the compiler and the compiled program using WINE. Alternately, you can set up a full Windows system as a guest OS using a virtualizer such as VirtualBox.
OTOH, if you want to write GUI programs for Linux, you'll have to specify the desktop manager you want to write for (usually either Gnome, KDE, or Unity) else use a portable library such as GTK+ or Qt.
Edited by Schol-R-LEA
Thanks for quick response. Actually i want to create a software in linux OS . Linux is completely 'c' basad OS, so why can't i make a windows programming with 'c' in it? Can you please suggest me which language is useful for that. I've knowledge in c,c++,shell scripting.
Oh, of course you can use C to write a GUI program for a Linux desktop environment; most of the ones you are likely to use under Linux are in C or C++.
However, the "windows.h" header has nothing to do with that. That header isn't for graphical user interface programming (at least not in the general sense); it is, rather, the Microsoft Windows operating system API header, a massive catch-all for Windows-specific system calls including not just GUI calls, but also scheduling, file handling, and Internet sockets. It is a huge collection of Windows functions, but it has nothing to do with Linux, which is a completely unrelated operating system.
There is no single equivalent to "windows.h" under Linux. Partly, this is because the Linux (and Unix) API is divided into many smaller parts; but in the case of GUI programming, the main reason is because Linux itself does not have any Graphical User Interface as part of the operating system. Indeed, one could argue that Linux has no user inteface built into it, as the user shell (whether text or graphics) is a user-side program, not part of the OS. The Linux Desktop Environments are not part of Linux; they can be interchanged and even in some cases run side-by-side at the same time on a single system.
This means that when writing a GUI program in Linux, you need to know what desktop you are using. Common ones include GNOME, Unity (the one which comes with Ubuntu by default), and KDE, but others include Enlightenment, XFCE, AfterStep, and Cinnamon. Most of them are built on top of the X Window System, a general toolbox of window widgets that is widely used in the Unix/Linux world.
There are also some libraries that allow you to write programs for several different desktop systems, such as Qt and GTK+. Chances are, one of these would be the best choice for what you are doing, as it wouldn't tie you to a specific desktop manager. My previous post has links to the two I mentioned, but there are a number of others as well, such as Tk. I would recommend GTK+ as a good starting point.
Each of these desktop managers and libraries will have their own headers, which will have the information for the graphical functions and related support such as event handling. While there is no single header that covers everything, the Linux solution is a lot more flexible than that of Windows.
Edited by Schol-R-LEA
Oh, I would add that, with regards to GUI programming, you'll usually have better luck with C++ than with C, simply because graphical user interfaces lend themselves to object-oriented design. The complexity of the data structures and the event handling make procedural programming for GUIs rough slogging. It can be done, of course, but it is a lot easier in an OOP language; indeed, it is likely that the main reason OOP caught on was the spread of GUIs. While OOP is not in any way shape or form a panacea for coding, it is uniquely well suited to graphical user interfaces, which involve a lot of large, repeatable, discrete, and composable data structures.
Edited by Schol-R-LEA
And if you use QT compiler you can have one set of source code for both *nix and Windows, AFAIK you won't have to rewrite anything to change from one os to the other, just recompile.
Fantastic post Schol-R-LEA except that sockets are one of the few things you don't get through Windows.h you have to explicitly include WinSock2.h :p
Also with some rather inverted logic because Windows.h is soooo big it can slow down compilation times so there are several symbols you can #define so that you don't include all of it into your program.
While code written for the QT enviroment can nominally be recompiled for either Windows or Linux (and we do do that at my work) you can't just write it willy-nilly you do have to remember to write your code portably.
Edited by Banfa