c++ - How can I make these typedefs work? -
These rows are in different header files and are being added to the source file in the following order:
VS 2013 Error C2371: 'Alice': redefinition; Various basic types
Why is this an error? Any way to work around it?
This is bad for declaring something as a class and both as a separate class For typedef though, names and type-tof names are interchangeable in many names, they are not always, e.g. It is possible to refer to the form of type as alice or class alice (which is called a wide-type-spacer) ) Is a square, but it is not valid if Alice is a typed name. This rule exits from C, where you can use only wide-type-specific And to be able to say it only to Alice , a different type has been announced.
The difference is important because this type of "name for link purposes" is the name, whose name is used for name-mangling, which affects the symbols that the linker will see.
If only the typed name in a file is used for the name of a function such as Alice and void foo (Alice *) You will not be able to link that work to other references to Void foo (Bob & lt; int & gt; *) even if they should have a single disturbance name.
For this reason, the compiler needs to differentiate between typing (which is just a nickname) and a type of "true name" (i.e. its name for its relation).
The only solution is to declare the types of alternatives, so that Alice is declared as a typeface to replace everywhere, i.e. code class Alice; with announcement:
template & lt; Class T & gt; Class Bob; Typing Bob & lt; Int & gt; Alice;
Comments
Post a Comment