473,405 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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 2376
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Georg Teichtmeister | last post by:
Hello! We are developing a math - library for realtime applications and want to use some given mathlibraries as base(ipp, MTL, .. ). Our library is a wrapper for those and you should be able to...
7
by: Steven T. Hatton | last post by:
Is there anything that gives a good description of how source code is converted into a translation unit, then object code, and then linked. I'm particularly interested in understanding why putting...
3
by: walkeraj | last post by:
I'm trying to compile an open source game called IVAN , and I'm able to compile it from a makefile, but not from an IDE. I have attempted to recreate the way the makefile compiles the project as...
6
by: pookiebearbottom | last post by:
Let's say I have headers Sal.h with this class class Sal { public: int doit() { return 1;} }; now I know that the compilier can choose NOT to inline this function. So if I include this in...
3
by: hamishd | last post by:
TestClass.obj : error LNK2005: "int volatile bIsProcessing" (?bIsProcessing@@3HC) already defined in OtherClass.obj Creating library Release/TestDLL.lib and object Release/TestDLL.exp...
0
by: capes | last post by:
have functions in my cell model calling CVODE for each time step. When I build the application I get a number of link errors: \cardiacsimulator.o Release\ccardiaccell.o Release\ccelldata.o...
1
by: Sylvain Audi | last post by:
I know that declaring a function as inline does not imply the function will actually be inlined (e.g. recursive functions, etc...). In that case, where would the function be instanciated? My...
7
by: bajichuan | last post by:
Hello! I have the world's strangest linking error, and I'm hoping that someone can help me sort it out. I recently installed and compiled a library called LinBox without a problem. I have an...
5
by: ciccio | last post by:
Hi, I have a problem with my code that the compiler does not find any inline functions which are static. The simple code example is written below, this is what the compiler throws at me. ]...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.