getting linker error - multiple definition of the function

P

pavan734

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.
 
S

Sunil Varma

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?
 
V

Victor Bazarov

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
 
P

pavan734

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top