Society of Robots - Robot Forum

Software => Software => Topic started by: clone on January 18, 2009, 12:17:00 AM

Title: library question
Post by: clone on January 18, 2009, 12:17:00 AM
ok... so im kinda a newb with robotics.. but i've been programming for a long time with macromedia flash, and my programming foundation is pretty strong.  the thing that i struggled with when learning C in college was the use of header files and libraries... i just dont really grasp the concept of them.   Can somebody help me understand what header files and libraries are all about? please?  help!! thnx.  if someone with the knowledge would be kind enough to pm for 1 on 1 walkthru that would be awesome......  I just need a boost thru the basics then i'll be pimpin!
Title: Re: library question
Post by: cosminprund on January 18, 2009, 01:03:47 AM
When you're programming in Flash you use a bunch of function and objects to do what you need to do. Everything is available all the time. That's fine because Flash "programs" are interpreted by the Flash player and the Player already includes everything that's required for those objects/functions to be made available.

When you're programming in C you get to choose from a MUCH larger selection of available stuff. I'm willing to bet there's a C library out there for whatever you want to do (or have seen someone else do). Obviously you can't have everything available at all times, it would be too much. That's where the headers and libraries play a role. Someone smart makes a library that does something you like. You download that library. In order to tell the C compiler it can use the library you add a "#include" line at the top of your C file. That's it!
Title: Re: library question
Post by: clone on January 19, 2009, 04:11:45 PM
sweet, thanks for the info... so how do you know whats in a library? do u open it or something?
Title: Re: library question
Post by: Webbot on January 19, 2009, 07:36:27 PM
sweet, thanks for the info... so how do you know whats in a library? do u open it or something?

yes - most libraries are shipped as *.h' files. so you can open them up in a text editor and each function should have some descriptive text above it that says what it does.