473,769 Members | 2,100 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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::setValu e(int new_value) throw() { value_ =
new_value; }

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

removing the inline keyword fixes the problem
any advice would be much appreciated
Jun 27 '08 #1
1 2398
On Wed, 21 May 2008 17:28:43 -0700 (PDT), arjor <as****@gmail.c om>
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::setValu e(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::setValu e(int)" (?setValue@vert ex@@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.l earn.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
17833
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 select the underlying library by template parameter. Therefore we split up our library in two namespaces: The first one defines namespace-global functions which call the baselibrary functions. These are templatefunctions which some
7
5122
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 normal functions in header files results in multiple definition errors even when include guards are used. -- STH Hatton's Law: "There is only One inviolable Law" KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com Mozilla:...
3
4374
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 closely as possible, yet I'm getting odd linking errors. I think I've traced it to some kind of problem with the SDL libraries it uses, yet I can't explain why it will compile from the makefile and not from the IDE. I have made sure that the ide...
6
2915
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 two different libraries, they both choose to
3
2172
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 Release/TestDLL.dll : fatal error LNK1169: one or more multiply defined symbols found In TestClass header file I have: volatile BOOL bIsProcessing;
0
1906
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 Release\cgapjunction.o Release\cheart2d.o Release\integrator.o -o D:\kp\programs\cardiacsimulator\Release\cardiacsimulator.exe Release\integrator.o: In function `func_f': /cygdrive/d/kp/programs/cardiacsimulator/integrator.cpp:70: multiple...
1
1466
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 guess is that it would be instanciated in the compilation unit that uses it. But in this case, several compilation units that use the same inline function would mean that the linker has to deal with several instances of the same function: shouldn't...
7
1859
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 object-oriented software application, and I want it to call the library. When I add the following 3 lines (copied directly from the library tutorial), #include <linbox/field/modular.h> using namespace LinBox; typedef Modular<shortField;
5
5058
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. ] $ g++ main.cpp foo.cpp /home/klaas/tmp/cciAcYgl.o: In function `main':
0
9579
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10038
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8867
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7404
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5294
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3952
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3558
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2812
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.