Home > Back-end >  C multiple definition problem cannot be solved!!!!!!
C multiple definition problem cannot be solved!!!!!!

Time:10-11

A header file, and two CPP

CodePudding user response:

Different compiler problem;
In the user. Adding extern CPP void disp (... Try)

CodePudding user response:

You put the default parameters in the h file to define inside see
Doubt is no default parameters on the part of the reason

CodePudding user response:

H file
Void disp (int x=1, int y=1, int z=1);

CodePudding user response:

.h statement,
CPP implementation,
Include the header file

CodePudding user response:

reference 1st floor soulsoul_god response:
different compiler issues;
In the user. Adding extern CPP void disp (... ) try

Can!!!! But after I knock on the code to add extern? I should be a header file, a CPP? Or change the software?

CodePudding user response:

Fun
reference 3 floor response:
h file
Void disp (int x=1, int y=1, int z=1);

This doesn't work! Add extern to be

CodePudding user response:

reference 4 floor smwhotjay response:
h statement,
CPP implementation,
Include the header file

I just like that,. H are library and statement. CPP defined and implemented?

CodePudding user response:

reference 5 floor zhupc123 reply:
Quote: refer to 1st floor soulsoul_god response:
different compiler issues;
In the user. Adding extern CPP void disp (... ) try

Can!!!! But after I knock on the code to add extern? I should be a header file, a CPP? Or change the software?


You to understand the usage of the extern knew, not a software problem, standard writing is like this

CodePudding user response:

Write a header file without macro definition,,,
# # ifndef xxx_H
# define xxx_H

#endif
  • Related