inlining...

Started by
1 comment, last by Ersvik 21 years, 8 months ago
When I inline my functions and put the implementation in a source file, the linker can''t find it. Why? Thanks Johan Ersvik
Johan
Advertisement
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
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..."

This topic is closed to new replies.

Advertisement