By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,804 Members | 1,631 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,804 IT Pros & Developers. It's quick & easy.

getting linker error - multiple definition of the function

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a

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

P: n/a
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

P: n/a
> 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

P: n/a

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 discussion thread is closed

Replies have been disabled for this discussion.