LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 09-10-2003, 05:02 PM   #1
surio
Member
 
Registered: Sep 2003
Location: Jambudvipa
Distribution: Debian & cousins, Slackware & sisters, Windows 7 (:trollface:), korora
Posts: 31

Rep: Reputation: 1
gcc won't recognise local header files


Hello everybody,

I am using a dedicated SuSE Linux 8.0 Pentium IV box for some development work on 'C' language. This is my first brush with the gcc(v2.95.1) compiler.

Let me explain my approach to the solution.
I have a mainProg.c which contains most of the variables and the main() function. Another file, llist.c contains one function that is called from mainProg.c for manipulating the data structures in the main program. There is an llist.h that contains the function prototye of llist.c.

When I compile mainProg.c, I have no problems, except for some warnings. However, if I decide to build an executable from these set of files, I get the following errors:

Command:
---------
gcc -lm -o mainProg mainProg.o

Note:- I added -lm after gcc failed to recognise sin, cos and atan functions, *in spite of* my including <math.h>! Can anyone enlighten me on this, please?

P.S: I also tried including "-include llist.h" after -lm

Output:
-------
% make
gcc -lm -include llist.h -o mainProg mainProg.o
mainProg.o: In function `plan_path':
mainProg.o(.text+0xe8): undefined reference to `append_to_list'
mainProg.o(.text+0x194): undefined reference to `append_to_list'
collect2: ld returned 1 exit status
make: *** [mainProg] Error 1
%

Please note that append_to_list is the function included in the file llist.c and prototyped in llist.h. mainProg.c includes the "llist.h" header file in it.

I am currently trying to read the gcc manual. The manual has extensive information in it for all its options(C,C++, Fortran, etc.). It is all very confusing to start at the deep end.

Could anyone please tell me what is happening here, and throw some light on the problem.

I have tried to give as much information as I can, but I am sorry if the post looks long-winded.

Thanks very much for your patience. Any help is much appreciated.

Suresh.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Including header files and source files for classes Feenix Programming 8 09-28-2005 10:53 AM
header files? trscookie Programming 8 03-16-2005 06:02 PM
gcc header files and cpp files? EchO Linux - Software 3 03-01-2005 01:14 AM
Compiling a header file with gcc Squall Linux - Software 2 04-07-2004 05:16 AM
c header files in linux in place of header files in windows? harun_acs Programming 1 03-17-2004 02:24 AM


All times are GMT -5. The time now is 07:53 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration