C++ can't create vector -
It is weird that I made a vector right in a square but it has not been made in any other category. She has a representation to me:
main.h
#include & lt; Windows.h & gt; # Include & lt; Shellpi h & gt; # Include & lt; Vector & gt; #include & lt; String & gt; # Include & lt; Iostream & gt; # Included "Taco H" class MyClass {public: int nothingint; Of vector & lt; Int & gt; My order; };
Taco H
#include & lt; Vector & gt; Class other class {public: vector & lt; Int & gt; OtherOrder; };
And I compile errors regarding vector announcement in Taco:
error C2143: syntax error: missing ';' '& Lt;' Error before C4430: Missing type specifier - int assumed note: C ++ does not support the default-int error C2238: unexpected token predecessor ';'
What am I missing here? I can end the second vector declaration and compile it properly.
Try:
std :: vector & lt; Integer & gt; OtherOrder;
vector
std
is part of the namespace. This means that whenever you use a vector
in a header file, you should include the std ::
prefix.
The reason for this is that you can sometimes get it forgotten by forgetting that some of the included files can use the namespace std;
In these, you allow the prefix to be omitted. However, you should avoid by using the
keyword in the header file, as it will corrupt the namespace of any files that are included in
.
Explain the dangers of using the namespaces for more detailed information ...
, see.
Comments
Post a Comment