473,385 Members | 1,707 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,385 software developers and data experts.

getting linker error - multiple definition of the function

Hello I have one .h file which I have includeded completely under
#ifndef followed by #define guards. I have the member function
definitions in the same .h file only. Still Iam getting linker errors
saying that "multiple definition of the function: ". Iam getting that
error for all the member functions of that class.

Jun 26 '06 #1
4 7603

pa******@gmail.com wrote:
Hello I have one .h file which I have includeded completely under
#ifndef followed by #define guards. I have the member function
definitions in the same .h file only. Still Iam getting linker errors
saying that "multiple definition of the function: ". Iam getting that
error for all the member functions of that class.


could you post the code?

Jun 26 '06 #2
pa******@gmail.com wrote:
Hello I have one .h file which I have includeded completely under
#ifndef followed by #define guards.
....which prevents this header from being included more than once in
the _same_ tranlsation unit, not in *different* ones.
I have the member function
definitions in the same .h file only. Still Iam getting linker errors
saying that "multiple definition of the function: ". Iam getting that
error for all the member functions of that class.


If they are defined outside of the class definition, declare them all
'inline'.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 26 '06 #3
> pa******@gmail.com wrote:
Hello I have one .h file which I have includeded completely under
#ifndef followed by #define guards.


...which prevents this header from being included more than once in
the _same_ tranlsation unit, not in *different* ones.


refer the following on the same group
http://groups.google.co.in/group/com...48a127f884ed9f

Jun 26 '06 #4

Thank you very much to every one. I have now made all the functions
inline and now Iam nt getting any multiple definition errors.

Jun 27 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: John | last post by:
Hi all; I write my first code using vector and list. When I run it, segmentation fault. Try to debug it, but it can not pass linking with -g option. What is the error with it? Thanks a lot....
12
by: Baloff | last post by:
Hello I have this linker error which makes me think that the definition file is not being seen by the linker, this code is taken from "Thinking in C++, 2nd Edition, Volume 1, Annotated Solutions...
4
by: Andrew | last post by:
Hello, I am recieving a multiple definition error from the linker when I try to build a project I am working on. The message states that the functions I defined within an external .c source file...
9
by: Peter Oliphant | last post by:
For some reson my code is generating a LNK1215 error, which 'suggests' I re-install VS C++. So I did. which did NOT solve the problem. The weid part is it seems to be caused by my one CPP file, but...
1
by: bereng | last post by:
Hi, I must have hit my head real hard sometime these days as after starting to use a redhat 9 machine I cannot link a stupid c++ project. I've spent 3 days googling down to results page 20 and...
2
by: Robbie Hatley | last post by:
"Victor Bazarov" <v.Abazarov@comAcast.net> wrote: > Robbie Hatley wrote: > > > > I ran into a problem a few days ago when I added a couple of > > template functions to one of my personal...
1
by: ImamicPH | last post by:
Hi, My first post. How do you resolve linker errors? I have a simple header file that contains one function declaration. This function is used in another file (.cpp) in the definition of a...
2
by: Markus Dehmann | last post by:
What to do if an external library is header-files-only (but you have to use it), and you get lots of linker errors? You will necessarily get linker errors "multiple definition of ..." if you try...
3
by: Rahul | last post by:
Hi Everyone, I have the following polymorphic classes, class Shape { public : virtual void draw() { } virtual void sample();
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.