Re: how to call Functions implemented in other file?

"Eric Polino" <[email protected]>
Newsgroups org.kernel.vger.linux-c-programming
Message-ID <[email protected]>
You need to compile this other file and add it to your compile line
and include the .h file for it.  For instance.

/path/to/file/foo.c
/path/to/file/foo.h
/path/to/file/foo.o

/home/user/yourProgram.c

/* yourProgram.c */
#include "/path/to/file/foo.h"

...


$ gcc /path/to/file/foo.o yourProgram.c

This is a very simplified version of what you could do.  Though this
doesn't account for possible library requirements of this object file.
 If this .c file is provided by your distibution or some other
program.  There is most likely a library or something to use the
functionality it has.  In theory this can all work, but things are
rarely designed to work this way.  I would reconsider your desire to
use this .c file.

Cheers,
Eric

On Tue, May 27, 2008 at 9:06 AM, houanito <[email protected]> wrote:
>
> hello!
>
> i have a problem using gcc c Complier in Unix.
> I want to use a function which is implemented in a file in another path.This
> function is  written by the distirbuters of the system and so the system
> uses this function.But i want to use that in order to do one part of my
> homework.
> Because the file that contains this function is *.c and not *.h, adding
> #include *.c to my code,generates problem..
>
> any help??thanks!
> --
> View this message in context: http://www.nabble.com/how-to-call-Functions-implemented-in-other-file--tp17490027p17490027.html
> Sent from the linux-c-programming mailing list archive at Nabble.com.
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



-- 
"None are more hopelessly enslaved than those who falsely believe they
are free."
 --Goethe

"Freedom is living without government coercion."
 --Ron Paul (www.ronpaul2008.com)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.