Thread: graphics in ansi c ?

  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    5

    Question graphics in ansi c ?

    hi, i wondering, how can i use graphics in ansi c ?
    i use linux and gcc . thanks

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    There is no such thing as graphics in ANSI-C.

    You need a library of some sort, for example
    Simple DirectMedia Layer
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User \007's Avatar
    Join Date
    Dec 2010
    Posts
    179
    Hello, you may check out a number of multimedia libraries.

    SDL was mentioned above. You may also check out SFML or programming in OpenGL directly. You will find a lot of C++ libraries, but you can find C versions of most as well. SFML has a nice plain C library and it's much easier to use than SDL.

    SFML - Simple and Fast Multimedia Library

  4. #4
    Registered User
    Join Date
    Dec 2010
    Posts
    71
    SDL supports Linux, Windows, Windows CE, BeOS, MacOS, Mac OS X, FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, IRIX, and QNX. The code contains support for AmigaOS, Dreamcast, Atari, AIX, OSF/Tru64, RISC OS, SymbianOS, and OS/2, but these are not officially supported.
    nice, thanks @Salem.My question is stupid but ,it does not work in CLI?

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Correct - Command Line Interface is text oriented.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Registered User
    Join Date
    Dec 2010
    Posts
    71
    Now I noticed that if I do a new project(in code blocks) is listed among others and SDL.I need to install the library?

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Yes, you will need to install something.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  8. #8
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Quote Originally Posted by nutzu2010 View Post
    Now I noticed that if I do a new project(in code blocks) is listed among others and SDL.I need to install the library?
    Code::Blocks is just an IDE/editor; if your Compiler does NOT have the needed Library; then, YOU must install it.

    Tim S.

  9. #9
    Registered User
    Join Date
    Dec 2010
    Posts
    71
    ok, thanks for the replies and sorry for offtopic

  10. #10
    Registered User \007's Avatar
    Join Date
    Dec 2010
    Posts
    179
    It's not off topic. It can be a bit tricky to install new libraries in Windows. It tends to be a bit easier in Linux. If you don't have a firm grasp of the command line, and the utilities you use it will be even more daunting to install new libraries. If you need more help finding a tutorial on getting set up with a multi media library let us know.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. graphics.h link error
    By aristotle1 in forum C Programming
    Replies: 4
    Last Post: 02-25-2010, 10:11 AM
  2. Beginning Game Programming Type Books
    By bumfluff in forum Game Programming
    Replies: 36
    Last Post: 09-13-2006, 04:15 PM
  3. Display ANSI graphics in C from TheDraw?
    By Ash1981 in forum C Programming
    Replies: 2
    Last Post: 12-30-2005, 02:37 AM
  4. ANSI C Graphics programming
    By Xoid in forum C Programming
    Replies: 5
    Last Post: 03-31-2003, 12:33 PM
  5. Graphics Devices and Cprintf clash
    By etnies in forum C Programming
    Replies: 6
    Last Post: 05-09-2002, 11:14 AM