Linux - SoftwareThis 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.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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:
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
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.