what is the best standard C libary for ubuntu?

This is a discussion on what is the best standard C libary for ubuntu? within the Linux Programming forums, part of the Platform Specific Boards category; I want to do some graphics programming with gcc, and am wondering which is the best graphics libary to use. ...

  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    16

    what is the best standard C libary for ubuntu?

    I want to do some graphics programming with gcc, and am wondering which is the best graphics libary to use.

    Cheers Mick

  2. #2
    Registered User
    Join Date
    Jul 2007
    Posts
    131
    C standard library != graphics library. You already have a c standard library, most of your system depend on it. For graphics library check SDL for 2D and OpenGL for 3D. If you want to write GUI, read about Qt (C++, used by KDE) or Gtk (C, used by Gnome, pain in arse).

  3. #3
    Registered User
    Join Date
    Sep 2009
    Posts
    16
    I used synaptic to download libsdl1.2-dev and tried to compile a sample file, but the headers were not recognised.

    :|

    Cheers Mick

  4. #4
    Registered User
    Join Date
    Jul 2007
    Posts
    131
    Are the headers located in some directory which is in your include path?

  5. #5
    Allways learning cs_student's Avatar
    Join Date
    Aug 2008
    Location
    ~/
    Posts
    39
    There is a pretty good guide for setting up and creating a simple test program at lazyfoo.net.

    Just skip the part about downloading and installing the rpm since you have already installed the deb.

    If your using automake && autoconf

    Then just copy
    Code:
    <insert_var_here>_LDADD = -lSDL
    to your Makefile.am

  6. #6
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    I believe SDL is a C++ API.

    If you want to use C, just use openGL (which is the 3D graphics part of SDL) with "glut".
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  7. #7
    Allways learning cs_student's Avatar
    Join Date
    Aug 2008
    Location
    ~/
    Posts
    39
    Nope, it's a C graphics API, so you can use it with C or C++.

  8. #8
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Quote Originally Posted by MK27 View Post
    I believe SDL is a C++ API.

    If you want to use C, just use openGL (which is the 3D graphics part of SDL) with "glut".
    Standard "glut" is abandoned. And the "forks" like freeglut don't really offer much. I'd go with SDL or glfw if you want to use OpenGL.

  9. #9
    Registered User
    Join Date
    Sep 2009
    Posts
    16
    Quote Originally Posted by cs_student View Post
    There is a pretty good guide for setting up and creating a simple test program at lazyfoo.net.

    Just skip the part about downloading and installing the rpm since you have already installed the deb.

    If your using automake && autoconf

    Then just copy
    Code:
    <insert_var_here>_LDADD = -lSDL
    to your Makefile.am
    Is that a already made makefile? Or will I have to create it? If not, where would I find it?
    Also do I have to enter a value for insert_var_here?

    Edit: up until now I have just been typing gcc -o test test.c
    Last edited by mickpc; 09-27-2009 at 09:03 PM.

  10. #10
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by zacs7 View Post
    Standard "glut" is abandoned. And the "forks" like freeglut don't really offer much. I'd go with SDL or glfw if you want to use OpenGL.
    Well, okay, I meant freeglut, since yes, the original glut is defunct. I've used it with all the standard docs that refer to glut (inc, eg, the OGL superbible, AND the red book). It is maintained and it works perfectly. I believe everything that was in glut is in freeglut*, I've seen this stated a number of times and never heard anything to the contrary, so you are are full of tish on this. If you go to the official openGL forum and make this claim, you will get laughed off the page. Sorry. Freeglut is widely used, and it functions identically w/r/t any documentation that includes glut (which is most or all OGL documentation for beginners).

    @mickpc: you need to use linker flags, eg for OGL/glut:

    gcc test.c -lglut -lGLU -lGL -lXext -lX11 -lm

    Maybe some nice person will post the flags for SDL; if not I am sure they are on page one of the intro tutorial or whatever...

    * in any case, IMO you might as well keep your use of glut to a minimum; all it has to do is manage a window and an event loop. This way, when you want to really polish up and handle your own loop and window management, you will not find you have written something that involves a lot of higher-level functions from a secondary toolkit. The point of glut is just to allow you to do pure OpenGL programming easily. It is not to add a whole bunch of features like sound effects or whatever. It is a "low level" approach vs. the "high level" of SDL, which is it's own thing that potentially includes OGL -- whereas glut doesn't do anything except provide a cross-platform for OGL. It is and should be minimal. I have nothing against SDL, just this is apples and oranges. AFAICT (I have written a simple patch for tuxpaint, which is an SDL kid's game), you can do all kinds of stuff with SDL that really have absolutely nothing to do with 3D graphics programming.
    Last edited by MK27; 09-28-2009 at 12:23 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  11. #11
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    kennedy != graphics programmer PERIOD!!!

    . . . but, I thought that GTK was considered the "standard"?

  12. #12
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Kennedy View Post
    kennedy != graphics programmer PERIOD!!!

    . . . but, I thought that GTK was considered the "standard"?
    GTK is a GUI API, not 3D. Like firefox (in linux) uses GTK. I believe there is a widget to embed 3D stuff, namely OGL, but I've never tried it.

    ps. you can thread GTK and OGL/glut together...
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  13. #13
    Registered User
    Join Date
    Jul 2007
    Posts
    131
    SDL is written in C, but it has bindings for frigging many languages. But basically it's a C library.

    GTK is "standard" widget toolkit on GNU, because it's used by GNOME.

    Portable graphics programming => SDL with OpenGL.
    Non-portable graphics programming for Unix-likes => Xlib, GLX, GLUT or whatever you want.
    Portable GUI => if you want C++, Qt, if you don't, just do it or suffer.

  14. #14
    Registered User
    Join Date
    Oct 2006
    Posts
    2,142
    Quote Originally Posted by fronty View Post
    SDL is written in C, but it has bindings for frigging many languages. But basically it's a C library.

    GTK is "standard" widget toolkit on GNU, because it's used by GNOME.

    Portable graphics programming => SDL with OpenGL.
    Non-portable graphics programming for Unix-likes => Xlib, GLX, GLUT or whatever you want.
    Portable GUI => if you want C++, Qt, if you don't, just do it or suffer.
    Qt is not the only portable C++ gui toolkit. I use wxWidgets almost exclusively for gui stuff, and it's everything I need and more. it includes OpenGL stuff as well, and is certainly worth looking into if you want a truly cross-platform gui toolkit with OpenGL capability.

  15. #15
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Actually GTK is cross-platform as well. AFAIK, glut is not tho [edit: wrong]. The GTK openGL extension does not appear to use glut.
    Last edited by MK27; 09-28-2009 at 12:24 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Standard efficiency
    By Jorl17 in forum C Programming
    Replies: 3
    Last Post: 06-18-2009, 11:48 AM
  2. array initialization & C standard
    By jim mcnamara in forum C Programming
    Replies: 2
    Last Post: 09-12-2008, 03:25 PM
  3. include question
    By Wanted420 in forum C++ Programming
    Replies: 8
    Last Post: 10-17-2003, 03:49 AM
  4. C/C++ standard
    By confuted in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 07-06-2003, 03:22 AM
  5. standard language, standard compiler?
    By doubleanti in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 09-03-2001, 04:21 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21