LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-13-2006, 11:35 AM   #1
ArthurHuang
Member
 
Registered: Jan 2006
Posts: 174

Rep: Reputation: 30
How to let source code know where the header file is?


Suppose I write a header file: head.h
and in the source code head.c, I want to write like:

#include "head.h"

How to configure the system to let head.c know where head.h is?
(They are in different dictionary)
 
Old 06-13-2006, 11:46 AM   #2
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
It all depends on where the directory is.
something like:
#include "../include/headerfile.h"
 
Old 06-13-2006, 11:58 AM   #3
ArthurHuang
Member
 
Registered: Jan 2006
Posts: 174

Original Poster
Rep: Reputation: 30
It works but it's not a standard way.
Once you have many source files or move the header files to another path, you must change everywhere.
It is not convenient.
 
Old 06-13-2006, 12:01 PM   #4
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
"It is not convenient." sorry.
My post assumes that the directory structure is predefined and will not change, so that when the source is supplied to a user the structure is the same.

makefile.am
Quote:
# not a GNU package. You can remove this line, if
# have all needed files, that a GNU package needs
AUTOMAKE_OPTIONS = foreign 1.4

SUBDIRS = src
INCLUDES = -I$(top_srcdir)/include/

Last edited by dmail; 06-13-2006 at 12:05 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
source code for file(1) dombrowsky Linux - Software 2 02-11-2006 02:38 PM
Including the header file of a module in kernel code omkarlagu Linux - Newbie 0 02-05-2006 07:55 AM
source code of others.h header file cynthia_thomas Linux - General 1 02-01-2006 08:29 AM
what is the file location of Redhat source code?? nazib Linux - General 1 02-26-2005 03:18 AM
Problems with making file from source code justinmc Linux - Software 5 01-09-2005 09:44 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration