linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Eric Polino" <aluink@gmail.com>
To: houanito <mhyp_power@hotmail.com>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: how to call Functions implemented in other file?
Date: Tue, 27 May 2008 11:23:36 -0400	[thread overview]
Message-ID: <b21328ed0805270823l4e2df81dq3b7264234a3dc37d@mail.gmail.com> (raw)
In-Reply-To: <17490027.post@talk.nabble.com>

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)

      reply	other threads:[~2008-05-27 15:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-27 13:06 how to call Functions implemented in other file? houanito
2008-05-27 15:23 ` Eric Polino [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b21328ed0805270823l4e2df81dq3b7264234a3dc37d@mail.gmail.com \
    --to=aluink@gmail.com \
    --cc=linux-c-programming@vger.kernel.org \
    --cc=mhyp_power@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).