* how to call Functions implemented in other file?
@ 2008-05-27 13:06 houanito
2008-05-27 15:23 ` Eric Polino
0 siblings, 1 reply; 2+ messages in thread
From: houanito @ 2008-05-27 13:06 UTC (permalink / raw)
To: linux-c-programming
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: how to call Functions implemented in other file?
2008-05-27 13:06 how to call Functions implemented in other file? houanito
@ 2008-05-27 15:23 ` Eric Polino
0 siblings, 0 replies; 2+ messages in thread
From: Eric Polino @ 2008-05-27 15:23 UTC (permalink / raw)
To: houanito; +Cc: linux-c-programming
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 <mhyp_power@hotmail.com> 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 majordomo@vger.kernel.org
> 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)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-05-27 15:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-27 13:06 how to call Functions implemented in other file? houanito
2008-05-27 15:23 ` Eric Polino
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).