Thread: what is the best standard C libary for ubuntu?

  1. #16
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    Quote Originally Posted by MK27 View Post
    Actually GTK is cross-platform as well. AFAIK, glut is not tho. The GTK openGL extension does not appear to use glut.
    I thought the main point of GLUT was to support cross-platform OpenGL programming?
    bit∙hub [bit-huhb] n. A source and destination for information.

  2. #17
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by bithub View Post
    I thought the main point of GLUT was to support cross-platform OpenGL programming?
    YES! Sorry, you are correct. All those books were not written just for linux users!

    I was mixed up slightly because of course the chapters on "OGL without glut" are divided into linux, windows, and mac. I had it in my head I'd just been following the linux part, silly me.

    So yeah, that is the further point of glut -- to provide a uniform standard for the window management...however, this may be where the glut/freeglut distinction became an issue, since originally freeglut may not have been available for windows (methinks it is now), qv:

    http://freeglut.sourceforge.net/index.php#download

    Which basically explains that it is a 100% compatible replacement AND that it is an improvement. In my experience, there are no issues there. zacs7 is just a silly fool.
    Last edited by MK27; 09-28-2009 at 12:26 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

  3. #18
    Registered User
    Join Date
    Jul 2007
    Posts
    131
    Quote Originally Posted by MK27 View Post
    Actually GTK is cross-platform as well.
    Yes it is, but it's not meant to be used by people who care about their mental health. And Qt isn't just a toolkit, it provides much more.

  4. #19
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by fronty View Post
    Yes it is, but it's not meant to be used by people who care about their mental health. And Qt isn't just a toolkit, it provides much more.
    Oh come on. If you are worth your salt, you can deal with the treeview! After that it is mostly tea and crumpets.

    Plus Qt is butt-ugly

    Vis, "so much more", GTK is build on glib which is built with pthreads, I think these are portable too. glib is quite a monster if you like built in complex datatypes, threaded timers, threaded file handle/socket monitors, etc.
    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

  5. #20
    Registered User
    Join Date
    Jul 2007
    Posts
    131
    Qt looks almost like I want my C++ class libraries look like. But this is just matter of taste.

  6. #21
    Allways learning cs_student's Avatar
    Join Date
    Aug 2008
    Location
    ~/
    Posts
    39
    I'm rather positive that glut works on Linux, Mac, and Windows (maybe others, IDK).

    @OP
    To compile via command line without make just use
    Code:
    g++ -o myprogram mysource.cpp -lSDL
    However, I suggest you get acquainted with an IDE or learn to use automake && autoconfig as they will make your life much easier.

    Check out lazyfoo for great SDL tutorials.
    Checkout VTR for good Glut/OGL tutorials.

    Also, I'm just starting to learn c++, so I would not call myself a graphics expert (or any other sort of expert). So take any advice I give you with caution

    cs_student

  7. #22
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by cs_student View Post
    However, I suggest you get acquainted with an IDE or learn to use automake && autoconfig as they will make your life much easier.
    I would suggest the opposite -- it is hard to understand what on earth you would need an IDE or automake for when learning intro 3D programming.

    But I'm no expert either.
    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

  8. #23
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    2D graphics with the SDL: The SDL is a cross-platform C library with bindings to other languages. One of my favourites.

    I'll recommend the Lazy Foo tutorials a third time. Compiling an SDL program is usually done with a command line like
    Code:
    $ gcc `sdl-config --cflags` *.c -o program `sdl-config --libs`
    If you're lazy like me, you could probably get away with
    Code:
    $ gcc -I /usr/include/SDL *.c -o program -lSDL
    The command-line suggested above, namely
    Code:
    g++ -o myprogram mysource.cpp -lSDL
    works too if you #include <SDL/SDL.h>, but not if you use <SDL.h> or "SDL.h". The latter is recommended.

    3D graphics with OpenGL: OpenGL is just the way to go if you want 3D graphics.

    You can use [free-]glut if you like, or the SDL, or Qt to provide a wrapper around your OpenGL code. Those three are just the ones I've used, there are certainly others. Freeglut is definitely the simplest, I'd suggest starting there.

    Compiling an OpenGL program can usually be done with a command-line like
    Code:
    $ gcc *.c -o program -lGL
    Add -lGLu if you're using GLu, and add -lglut if you're using [free-]glut.

    GUI programming with Qt: I must say I've never used Qt 4 to any large degree, but I have used Qt 3, and it's a very nice toolkit. Qt is C++, cross-platform, and with a large number of available widgets built-in. Qt 3 is apparently a pain to get to work on Windows, but I assume Qt 4 is easier.

    GUI programming with GTK+ or wxWidgets: Sorry, never tried those, I can't really help you there. GTK+ is a C library, and wxWidgets is a C++ one.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  9. #24
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    I'll recommend the Lazy Foo tutorials a third time.
    Yes, everyone does. But those are C++ tutorials, the OP is asking about C.

    There is very little material on SDL in C on the web, beyond their official stuff (which is good):
    http://sdl.beuc.net/sdl.wiki/HelpContents

    I also have a long, well put together, very in-depth HTML'ified thing called the "SDL Library Documentation", but I do not know where I got it -- the only thing I've done with SDL was the tuxpaint patch hack, and that helped much there.

    I notice that if you google "SDL Library Documentation" there are some possible online & pdf versions around.

    I have a suspicion the people who did that (SDLdoc) created the help wiki since some of the text is word for word, while the old SDLdoc address is defunct.

    And, once again, if you are using OGL with glut on linux, you need to link to X as well:

    gcc test.c -lglut -lGLU -lGL -lXext -lX11
    Last edited by MK27; 09-29-2009 at 11:03 AM.
    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

  10. #25
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Quote Originally Posted by MK27 View Post
    And, once again, if you are using OGL with glut on linux, you need to link to X as well:

    gcc test.c -lglut -lGLU -lGL -lXext -lX11
    Interesting. Perhaps you do sometimes, but you don't have to on my laptop nor the two desktop machines I've tried. I presume all machines I mentioned are using freeglut and a Mesa implementation of OpenGL.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  11. #26
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by dwks View Post
    Interesting. Perhaps you do sometimes, but you don't have to on my laptop nor the two desktop machines I've tried. I presume all machines I mentioned are using freeglut and a Mesa implementation of OpenGL.
    Yeah, me too. I had all those flags in an environment variable to make it easy. I just noticed this does not work

    gcc test.c -lGL
    without -lglut, but sensibly enough

    gcc test.c -lglut
    does work all on it's own. So I guess the -lX11 flags aren't necessary.
    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

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