From: Rasheed on
hi
I have two header files like "Headerfile1.h" "Headerfile2.h" , In
"Headerfile2.h" i have declared "Headerfile1.h"

So in my application i have declared "Headerfile2.h" and i am using
some functions of "Headerfile1.h" in my application, and i could able
to compile successfully but at runtime linker unable to find the
function which is in "Headerfile1.h".
Can anybody tell me where i am doing wrong?
Regards
Rasheed.
From: AliR (VC++ MVP) on
Are you adding the implementation of the functions defined in the header
file to your project?

You will either have to add the cpp files with the function definitions to
the project, or link against a lib file that has the function
implementations.

AliR.

"Rasheed" <sk.rasheedfarhan(a)gmail.com> wrote in message
news:b71d618e-a91f-4c89-a35b-dd957e45b811(a)n1g2000prb.googlegroups.com...
> hi
> I have two header files like "Headerfile1.h" "Headerfile2.h" , In
> "Headerfile2.h" i have declared "Headerfile1.h"
>
> So in my application i have declared "Headerfile2.h" and i am using
> some functions of "Headerfile1.h" in my application, and i could able
> to compile successfully but at runtime linker unable to find the
> function which is in "Headerfile1.h".
> Can anybody tell me where i am doing wrong?
> Regards
> Rasheed.


From: Doug Harrison [MVP] on
On Mon, 12 May 2008 09:08:00 -0700 (PDT), Rasheed
<sk.rasheedfarhan(a)gmail.com> wrote:

>hi
> I have two header files like "Headerfile1.h" "Headerfile2.h" , In
>"Headerfile2.h" i have declared "Headerfile1.h"
>
>So in my application i have declared "Headerfile2.h" and i am using
>some functions of "Headerfile1.h" in my application, and i could able
>to compile successfully but at runtime linker unable to find the
>function which is in "Headerfile1.h".
>Can anybody tell me where i am doing wrong?

Where are the functions declared in HeaderFile1.h defined? You must link
the object file or library that contains their definitions. If they are
function templates, the template definitions must in general be in the
header file.

--
Doug Harrison
Visual C++ MVP
From: Joseph M. Newcomer on
You are confused.

Specifying a header file gives information to the compiler
At LINK time (not runtime), the linker needs to know the name of the .obj or .lib file
that contains the code
A RUN time, the code calls the function.

What you are doing wrong is failing to tell the LINKER where to find the CODE; it is not
sufficient to tell the COMPILER where to find the HEADER FILES.
joe

On Mon, 12 May 2008 09:08:00 -0700 (PDT), Rasheed <sk.rasheedfarhan(a)gmail.com> wrote:

>hi
> I have two header files like "Headerfile1.h" "Headerfile2.h" , In
>"Headerfile2.h" i have declared "Headerfile1.h"
>
>So in my application i have declared "Headerfile2.h" and i am using
>some functions of "Headerfile1.h" in my application, and i could able
>to compile successfully but at runtime linker unable to find the
>function which is in "Headerfile1.h".
>Can anybody tell me where i am doing wrong?
>Regards
>Rasheed.
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm