[luau] Dazzle me with your C programming prowess

Jimen Ching jching at flex.com
Mon Apr 22 14:14:51 PDT 2002


On Mon, 22 Apr 2002, Dean Fujioka wrote:
>> #include <stdio.h>
>> #include </usr/src/linux-2.4.18-0.16/drivers/ieee1394/raw1394.h>
>> #include </usr/local/include/libdc1394/dc1394_control.h>
>> #include <stdlib.h>
>> #include <time.h>
>> #include <sys/times.h>
>I thought homemade header files (not included in the standard library) need
>to be in quotes, not angel brackets, i.e.

According to the standard, qouted header files will cause the preprocessor
to search the source directory first.  If not found, or if using angle
brackets, the compiler will search an implementation-defined list of
directories.  It has nothing to do with 'standard libraries' or 'system
headers'.

>> #include </usr/src/linux-2.4.18-0.16/drivers/ieee1394/raw1394.h>
>> #include </usr/local/include/libdc1394/dc1394_control.h>

A library should not require the application to include a header file from
the kernel driver sources.  The library should install its own.  The
problem with including headers from the kernel source tree directly is
that the kernel source might change the API.  I.e. the library might
support version 2.4.x, but as soon as you upgrade the kernel to 2.5.x, it
no longer works.  The library should detect these problems and return
appropriate errors.

I suspect the raw1394.h is probably not needed.  If it actually is, I
recommend you look in /usr/include/linux or something similar.  I.e. do a
search for raw1394.h in /usr/include or /usr/local/include (and their
respective subdirectories).

Also, it is usually not necessary to specify the full path in #include
directives.  I.e. use this instead

#include "libdc1394/dc1394_control.h"

Then at the command line:

gcc -I/usr/local/include source_file.c -l/usr/local/lib -ldc1394

Note, people usually put the -I in front of the source file.  Though it
depends on the compiler.  I believe GCC allows it to be anywhere.

--jc
--
Jimen Ching (WH6BRR)      jching at flex.com     wh6brr at uhm.ampr.org




More information about the LUAU mailing list