C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 06-19-2009, 06:50 AM   #1
Registered User
 
Join Date: Jun 2009
Posts: 31
add a file.c in a program.

Hi

I've written a new function for a program.
I have the new_function.c, new_function.h and the new_function.o and I've added those 3 files in the same directory of the others files.
Then in the file.c (that use the new_function.c), I added:

Code:
#include "new_function.h"
then i try to do:

./configure ........... ok

but the "make" return with:
Quote:
926: undefined reference to `function_added'
where "function_added" is defined and implemented in new_function.h and new_function.c.

This is the first time for me, but i read that what i've done should be enough.
Any idea why doesn't work?
Thanks

D.
Dedalus is offline   Reply With Quote
Old 06-19-2009, 07:23 AM   #2
and the Hat of Guessing
 
tabstop's Avatar
 
Join Date: Nov 2007
Posts: 8,740
If you look at your makefile, is new_function.c or new_function.o mentioned anywhere? (How did you set up configure?)
tabstop is offline   Reply With Quote
Old 06-19-2009, 07:47 AM   #3
Registered User
 
Join Date: Jun 2009
Posts: 31
You are right, the makefile doesn't contain "new_function.o".

I'm not the author of the program, I've written just a function. So I have to add some reference in the configure file?

Thanks

D.
Dedalus is offline   Reply With Quote
Old 06-19-2009, 07:52 AM   #4
and the Hat of Guessing
 
tabstop's Avatar
 
Join Date: Nov 2007
Posts: 8,740
Right. I've never used configure scripts, so I don't know where it would go, but whatever or whoever builds the makefile would need to know what all the files are.

(Does the person/people who did write the program know or expect you to write an additional function? If so, they would probably have left same in the configure file.)
tabstop is offline   Reply With Quote
Old 06-19-2009, 07:59 AM   #5
Registered User
 
Join Date: Jun 2009
Posts: 31
Quote:
Originally Posted by tabstop View Post
(Does the person/people who did write the program know or expect you to write an additional function? If so, they would probably have left same in the configure file.)
Yes, he asked me to add this function. I'd like to learn how to do it

Thanks for your help, now I know where the problem is.

D.
Dedalus is offline   Reply With Quote
Old 06-19-2009, 08:00 AM   #6
and the hat of vanishing
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,214
IIRC, it's something like makefile.in which is read by configure to produce a customised makefile for your environment.
It's the input file(s) to configure which you need to look at changing.
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
Up to 8Mb PlusNet broadband from only £5.99 a month!
Salem is offline   Reply With Quote
Old 06-19-2009, 08:11 AM   #7
Registered User
 
Join Date: Jun 2009
Posts: 31
Yes there is a makefile.in,
I'm reading it. it is very long file, I'm looking for the configure input files.

thanks

D.
Dedalus is offline   Reply With Quote
Old 06-19-2009, 10:19 AM   #8
Registered User
 
Join Date: Jun 2009
Posts: 31
Hi
i found the solution.

I've added to Makefile.in and Makefile.source the file i created.

Now it works!!

Thanks

D
Dedalus is offline   Reply With Quote
Reply

Tags
function, new module

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Issue with program that's calling a function and has a loop tigerfansince84 C++ Programming 9 11-12-2008 01:38 PM
add your program to start menu ? Anddos Windows Programming 6 04-17-2008 04:15 AM
Dikumud maxorator C++ Programming 1 10-01-2005 06:39 AM
insufficient memory for tsr manmohan C Programming 8 01-02-2004 09:48 AM
My program, anyhelp @licomb C Programming 14 08-14-2001 10:04 PM


All times are GMT -6. The time now is 07:24 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

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