Header Files and Libraries


Compilation and Header Files


Linking and Libraries


Example

Compile and link:
    #include <stdio.h>
    #include <math.h>

    main() {
 
        int i;
        float x;

        for (i = 0;  i <= 10;  i++) {

            x = sin(i);

            printf("i = %d, ", i);
            printf("x = %f\n", x);
          }
      }


Search Path Considerations

Each system will have default search paths on which the compiler and linker will search for header files and precompiled libraries. Sometimes we need to add to the default paths. For example:
    gcc -I/home/simonh/my_h -L/home/simonh/my_libs -lmylib my_prog.c


...previousup (conts)next...



About this document:

Produced from the SGML: /home/isd/public_html/_course_crash_in_c/_reml_grp/index.reml
On: 3/3/2003 at 17:43:41
Options: reml2 -i noindex -l long -o html -p multiple