Find the answer to your Linux question:
Results 1 to 6 of 6
Hello I have just started working with gcc. I created a header file(.h file with some macros and function prototypes) and included it in my .c file. But gcc while ...
  1. #1
    Just Joined!
    Join Date
    Jul 2005
    Posts
    41

    gcc not able to find user defined headers

    Hello

    I have just started working with gcc.
    I created a header file(.h file with some macros and function prototypes) and included it in my .c file.

    But gcc while compiling said, could not find grid.h, tat's my header file name,
    But whe I included the whole path to the header file in my #include in .c file line this

    #include</amd/poptart/root/t/tarora/rmfol/grid.h>

    it had no problem because it got compkete path.
    How can I avoid this, that is using complete path and make gcc look into the folder , as my .c and .h file are in same folder

    -Thank you

  2. #2
    Just Joined!
    Join Date
    Jul 2005
    Posts
    41
    I am on Ubuntu fiest 7.04

  3. #3
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Location
    Canada, Prince Edward Island
    Posts
    714
    try

    #include "grid.h"

  4. #4
    Just Joined!
    Join Date
    Jul 2005
    Posts
    41
    no,it still can't find grid.h?

  5. #5
    Just Joined!
    Join Date
    Apr 2005
    Location
    Romania
    Posts
    42
    .c and .h in the same directory. And then, as gerard4143 said, #include "grid.h"

  6. #6
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Location
    Canada, Prince Edward Island
    Posts
    714
    Quick question...is there a grid.o file and are you compiling with it i.e.

    gcc grid.o test.o -o test

    P.S. could you post the error message...Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...