Skip to main content
gamedev.net
🔒 Locked

Function Inlining in GCC

Started by Rolo Puentes Jan 20, 2003 at 9:47 AM 1 replies 200+ views
Original Post
Rolo Puentes
Rolo Puentes
Hey.. this question applies to GCC 2.95.x and GCC 3.1 (or above)... While doing some research on inlining function expansion I came across with this: "If you are using function inlining, you must: Have the inline functions implemented in the header file you include. " This is valid for MS Visual C++ 7.0, and since we''re working on a cross-platform product, I was wondering if the same rule is applied in the GCC versions I named above... The reason for this, according to MSDN documentation is: "Similarly, a project that uses function inlining yet defines the functions in a .cpp file rather than in the header file will also get error LNK2001. The header file is included everywhere deemed appropriate, but the functions are only inlined when the .cpp file passes through the compiler; therefore, the linker sees the functions as unresolved externals when used in other modules." It seems rather logical to me, but I may be wrong, any tip would be greatly appreciated. Thanks!
null_pointer
null_pointer
Yes, defining inline functions in header files is effectively required by the standard.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.