c graphics in linux - c

hi
can any one tell me how to make graphics program in c in Linux.
what header file i should use in gcc.I'm quite novice to Linux
thanx in advance

Googling for linux graphics library c gave this site with tons of libraries for all kinds of languages under all kinds of operating systems. HTH.

libSDL is one good library.

The Allegro library is pretty easy to use and covers a lot more than graphics.

Related

How does one add <graphics.h> into GCC on a Windows computer for C? [duplicate]

I have been searching to get the source code of the header file <graphics.h> and its associated library in order to integrate it with my C++ program.
At the same time, I am interested in those cross-platform libraries that works on more than one compiler. Just to be more explicit, I am talking about those libraries that are used for drawing shapes, lines, and curves in C++.
<graphics.h> is very old library. It's better to use something that is new
Here are some 2D libraries (platform independent) for C/C++
SDL
GTK+
Qt
Also there is a free very powerful 3D open source graphics library for C++
OGRE
<graphics.h> is not a standard header. Most commonly it refers to the header for Borland's BGI API for DOS and is antiquated at best.
However it is nicely simple; there is a Win32 implementation of the BGI interface called WinBGIm. It is implemented using Win32 GDI calls - the lowest level Windows graphics interface. As it is provided as source code, it is perhaps a simple way of understanding how GDI works.
WinBGIm however is by no means cross-platform. If all you want are simple graphics primitives, most of the higher level GUI libraries such as wxWidgets and Qt support that too. There are simpler libraries suggested in the possible duplicate answers mentioned in the comments.
There is a modern port for this Turbo C graphics interface, it's called WinBGIM, which emulates BGI graphics under MinGW/GCC.
I haven't it tried but it looks promising. For example initgraph creates a window, and
from this point you can draw into that window using the good old functions, at the end closegraph deletes the window. It also has some more advanced extensions (eg. mouse handling and double buffering).
When I first moved from DOS programming to Windows I didn't have internet, and I begged for something simple like this. But at the end I had to learn how to create windows and how to handle events and use device contexts from the offline help of the Windows SDK.
The Borland Graphics Interface, the library fronted by the graphics.h header, has been re-implemented atop SDL. This brings support for modern hardware and operating systems (multiple operating systems, in fact, since SDL is fairly portable).
It can be downloaded here prebuilt for a variety of common desktop targets.
Or if you wish to (or must) build it from source, here is a github mirror.
Note that it is a port of a very old software library and will run atop modern tools, so you should check with the instructor if you intend to use it for class assignments. It would be irritating to fail an assignment because you used idioms that require support from a modern compiler and find that they do not compile on a marking system from the 1980s.
You may find it better to get and develop with a virtual machine clone of the marking system to prevent nasty surprises.
graphics.h appears to something once bundled with Borland and/or Turbo C++, in the 90's.
http://www.daniweb.com/software-development/cpp/threads/17709/88149#post88149
It's unlikely that you will find any support for that file with modern compiler. For other graphics libraries check the list of "related" questions (questions related to this one). E.g., "A Simple, 2d cross-platform graphics library for c or c++?".

Is there any better and more suitable compiler for running basic graphics programs in c other than turbo c++?

I am trying to learn basic graphics programs in C and i want a more friendly and convenient compiler than turbo c which i am not able to find. Is there any better c compiler for graphics programs?
I would suggest you to use SDL2 for graphics programming. It is quite easy to use and allows you to draw simple shapes (circles, lines, rectangles, text, etc.)
Also you can easily set it up for modern IDE's such Visual Studio and Code Blocks.
Just google for " SDL setup" and you are good to go. Comment here if you are stuck somewhere.

Best quick alternative compiler/IDE to Turbo C that supports audio and graphics

I am making a small 2d GAME PACK as my University project. I am using Turboc 3.0 as the compiler. I am at a stage where I need better graphics and sound. Ive spent days looking for a workaround on the net and by myself too including audio and better graphics.Can you please tell me which Ide can be learnt quickly, as time is a constraint here?
Turbo C is just an IDE + compiler for the C programming language. C does not have any audio or graphics capabilities on its own, which means that you will not find a C IDE that readily incorporates such functionality. What you need is a library with a C API that will allow you to do such things.
IIRC Turbo C did come with a rudimentary graphics library for DOS, but I do not believe that there was any support for audio. Unfortunately (or not) Turbo C is pretty much obsolete these days. Most programs written in it would have issues on modern operating systems and handling audio and graphics on DOS essentially means talking straight to the hardware - definitely not something trivial.
If you are after a modern audio/graphics library, SDL is a popular choice for 2D games and, from my experience, rather easy to work with. You will probably need to couple it with a more modern programming environment though - I doubt Turbo C will cut it. You might want to have a look at one or more of the following for a compiler and/or IDE that will be fully functional on modern systems.:
Codeblocks
Dev-C++
Warning: this IDE has not been updated for quite some time. I have used it successfully in the past, but I would not recommend investing time and resources on it at this point.
Mingw32
Eclipse CDT, downloadable here
Warning: Eclipse is mostly targeted to professional developers. It is very powerful, but it can occasionally be rather confusing to use. While it will save you a lot of time in the long run, it may not be perfectly suitable for someone that needs to get work done right here, right now.
Visual Studio Express

Cygwin graphics?

I am currently using Netbeans with Cygwin on windows 7, and i'm looking to write a simple 2D game in C.
Most of the tutorials i've managed to find use the graphics.h supplied with Turbo C, does Cygwin have an alternative to this? Any info about how to get another header file installed, or links to tutorials would be greatly appreciated.
Cheers
SDL is a good library to use for basic game graphics. Note that Cygwin is not needed (unless you really need POSIX emulation) - Mingw will usually suffice.

How do I take C programming beyond the console?

I'm trying to learn some graphics programming using C. What would be the best way for a beginner to start? I'd like to how to make programs that use graphics and images that can be run directly from a command line prompt, and don't rely on a windowing system like X to execute.
Thanks,
Mike
Look into libsdl - Simple DirectMedia Layer. Although on Linux it can use X11 for displaying output, it can also directly use a framebuffer device. It's designed to be simple for pixel-bashing game-type programming, and supports a wide variety of platforms.
There's also Allegro if you're not a fan of SDL. It's somewhat more fully-featured for simple vector graphics; SDL is mainly a cross-platform framebuffer until you add extension libraries.
Learn some GUI toolkit like Qt or GTK, this way you will make modern GUI applications.
Check out the FLTK GUI toolkit. It is small and easy to learn.

Resources