Getting started (n00b)

This is a discussion on Getting started (n00b) within the Linux Programming forums, part of the Platform Specific Boards category; What LynuxPenguin was refering to was the fact that on Linux systems in the /usr/include directory, the gcc compiler includes ...

  1. #16
    TsunUntan
    Guest
    What LynuxPenguin was refering to was the fact that on Linux systems in the /usr/include directory, the gcc compiler includes all the standard header files into the program by default so if you miss a header file or find an undeclared function gcc checks the directory for the header file you wished to include, otherwise you need to include it directly or tell gcc where it is ex:

    gcc -lcrypt myencryption.c
    or
    #include <crypt.h>

    should work, although im not sure, but I read this somewhere, let me know ok?

  2. #17
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    If you miss a header file, your compiler should warn you by saying something like:
    >implicit declaration of function ...

    Generally, it isn't good practive to work like this though.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #18
    Registered User
    Join Date
    Jul 2002
    Posts
    161
    Originally posted by Hammer
    If you miss a header file, your compiler should warn you by saying something like:
    >implicit declaration of function ...

    Generally, it isn't good practive to work like this though.
    That's what I thought, but I doubted it would even compile. Just installed RH8.0 so I have had a chance to see if gcc 3 does. Doesn't seem like a real good idea though.

  4. #19
    LynuxPenguin
    Guest
    in my opnion you should always include the headers you want to use.

    Less work for the compiler, though I could be wrong oh also
    I ususally like to do
    gcc -o myname -Wall myprog.c
    so you can see a more definite error listing when it compiles

  5. #20
    Comment your source code! Lynux-Penguin's Avatar
    Join Date
    Apr 2002
    Posts
    533
    oops forgot the - in my name

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

Similar Threads

  1. Help getting started..matrices
    By BobDole11 in forum C Programming
    Replies: 7
    Last Post: 11-15-2008, 09:51 PM
  2. Getting started
    By panzeriti in forum Game Programming
    Replies: 3
    Last Post: 06-28-2003, 11:13 AM
  3. Getting Started
    By UnclePunker in forum Game Programming
    Replies: 3
    Last Post: 04-11-2003, 01:34 PM
  4. How to get started?
    By anoopks in forum Linux Programming
    Replies: 0
    Last Post: 01-14-2003, 03:48 AM
  5. Need help getting started
    By Unregistered in forum C++ Programming
    Replies: 4
    Last Post: 09-03-2001, 12:08 AM

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