Archived

This topic is now archived and is closed to further replies.

Ersvik

inlining...

Recommended Posts

When I inline my functions and put the implementation in a source file, the linker can''t find it. Why? Thanks Johan Ersvik

Share this post


Link to post
Share on other sites
Put your inline routines in a header file and include it where you need them.
This is (I think) how the compiler requires you to do it. I guess it''s because (like defined macros) it needs to know what it''s going to expand.

-Mezz

Share this post


Link to post
Share on other sites
It''s because the function has to be inlined before the link phase. Normally, when you make a call to a function with the declaration in a header and the definition in another file, it''s fine, because all the data needed for syntax, etc. is in the declaration, then when the link phase comes, it actually "makes the link," so the file making the call doesn''t have to know the definition before it''s compiled and linked. When you inline the function, since the function code is actually "inserted" during compilation rather than linked later on, unless it''s actually defined in a header file included by the function call, it won''t be able to compile. Hope that somewhat made sense!

--------------------
Matthew Calabrese
Realtime 3D Orchestra:
Programmer, Composer,
and 3D Artist/Animator
"I can see the music..."

Share this post


Link to post
Share on other sites