Jump to content
  • Advertisement


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



This topic is 5877 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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.


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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!