470,874 Members | 1,831 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,874 developers. It's quick & easy.

linking error with inline functions

hey guys

When i try to make the following mutating method inline i get the
following error:
//method
inline void vertex::setValue(int new_value) throw() { value_ =
new_value; }

error LNK2019: unresolved external symbol "public: void __thiscall
vertex::setValue(int)" (?setValue@vertex@@QAEXH@Z) referenced in
function _main

removing the inline keyword fixes the problem
any advice would be much appreciated
Jun 27 '08 #1
1 2171
On Wed, 21 May 2008 17:28:43 -0700 (PDT), arjor <as****@gmail.com>
wrote in comp.lang.c++:
hey guys

When i try to make the following mutating method inline i get the
following error:
//method
inline void vertex::setValue(int new_value) throw() { value_ =
new_value; }
When you try to make the function inline WHERE?
error LNK2019: unresolved external symbol "public: void __thiscall
vertex::setValue(int)" (?setValue@vertex@@QAEXH@Z) referenced in
function _main

removing the inline keyword fixes the problem
any advice would be much appreciated
The definition of the inline function must be in file that is
#include'd by every source file that uses. Not in a separate source
file that has the body of non-inlined functions.

The compiler can only generate inline code for a function when that
function's definition is in scope when the function is called.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Georg Teichtmeister | last post: by
3 posts views Thread by hamishd | last post: by
reply views Thread by capes | last post: by
1 post views Thread by Sylvain Audi | last post: by
7 posts views Thread by bajichuan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.