Jump to content
  • Advertisement
Sign in to follow this  

C++ vector problem

This topic is 3467 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello I have a header file with the code like this with name maths.h: class Polygon { public: vector<Point3> vecs; Polygon () { }; void insert(Point3 point); void remove(); Point3 fetch(int index); Vector3 normalized(); int classifyPoint(Point3& point); bool InFront(Polygon& poly); }; I have a code file class BSPTreeNode { public: vector<Polygon> PolygonSet; BSPTreeNode* RightNode; BSPTreeNode* LeftNode; //void insert(vector polygons, Polygon divider); }; The problem here when I compile it, I received an error saying : Error 1 error C2923: 'std::vector' : 'Polygon' is not a valid template type argument for parameter '_Ty' What does that mean? In my maths.h, I have a class say Point3 or Vector3. When I replace the <Polygon> with <Vector3> or <Point3>, the program can compile without error. Do anyone know what the problem is? Thank you

Share this post


Link to post
Share on other sites
Advertisement
There is something int windows.h that is called Polygon, which you cannot use as a template parameter. I don't know what exactly it is though. Rename your polygon class.

Share this post


Link to post
Share on other sites
Quote:
Original post by Brother Bob
There is something int windows.h that is called Polygon, which you cannot use as a template parameter. I don't know what exactly it is though. Rename your polygon class.


@OP: Or put yours in a namespace, although with the lack of "std::" in your header file (read: bad practice), you may not understand/like this idea.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!