Re: inline
From: tom_usenet (tom_usenet_at_hotmail.com)
Date: 05/21/04
- Next message: Brad Panek: "Re: Visual C++ 6 unstable on XP?"
- Previous message: GregM: "RE: Odd exception behavior"
- In reply to: Miki Peric: "inline"
- Next in thread: Miki Peric: "Re: inline"
- Reply: Miki Peric: "Re: inline"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 21 May 2004 13:44:03 +0100
On Fri, 21 May 2004 13:13:35 +0200, "Miki Peric" <blah@ccc.com> wrote:
>
>I have function defined as inline in header file. Function belongs to a
>class (class member). When linking as static lib, function is not linked
>into lib. When I include this lib into my project I got an unresolved linker
>error. Linker can't find function. What should I do?
I can't replicate your problem - linking isn't (or shouldn't be) an
issue for inline functions generally - they don't need to be linked
into the static library, since their definition is inserted directly
where used in general. An exception is when you take the address of
the function. Static local variables also require a bit more
compiler/linker jiggorypokery, so details of whether your inline
function contains any would be useful.
It would be helpful if you gave details of your source code
organization - all files that reference your inline function in any
way. e.g.
Library:
staticlib.h:
Class definition + inline function definition of "foo"
"foo" includes a static local variable.
staticlib.cpp:
#include "staticlib.h"
Non-inline definitions
staticlib2.cpp:
#include "staticlib.h"
Takes address of "foo"
Exe:
exe.cpp:
#include "staticlib.h"
uses "foo"
Or whatever.
Tom
-- C++ FAQ: http://www.parashift.com/c++-faq-lite/ C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
- Next message: Brad Panek: "Re: Visual C++ 6 unstable on XP?"
- Previous message: GregM: "RE: Odd exception behavior"
- In reply to: Miki Peric: "inline"
- Next in thread: Miki Peric: "Re: inline"
- Reply: Miki Peric: "Re: inline"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|