[ITK] Naming conflict ?
Dženan Zukić
dzenanz at gmail.com
Tue Nov 21 09:51:39 EST 2017
Hi Tim,
ITK indirectly includes windows headers, and your Arc class suffers a name
clash with
WINGDIAPI BOOL WINAPI *Arc*( _In_ HDC hdc, _In_ int x1, _In_ int y1, _In_
int x2, _In_ int y2, _In_ int x3, _In_ int y3, _In_ int x4, _In_ int y4);
in c:\Program Files (x86)\Windows Kits\8.1\Include\um\wingdi.h, line 3612.
If your declarations are enclosed in a namespace ...
namespace Tim
{
/* Forward declarations of Node and Arc classes since they are
interdependant */
class Node;
class Arc;
...
}
... the file compiles.
We are switching to discourse <https://discourse.itk.org/>, so please make
future posts there.
Regards,
Dženan
On Tue, Nov 21, 2017 at 5:36 AM, Timothee Evain <tevain at telecom-paristech.fr
> wrote:
> Hi Dženan!
>
> Sure, here you are :
> error C2061: syntax error : identifier 'Arc' 27
> error C2061: syntax error : identifier 'Arc' 31
> error C2143: syntax error : missing ';' before '*' 30
> error C2143: syntax error : missing ';' before '*' 49
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int 30
> error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int 49
>
> given with the following code (I haven't included the definitions has they
> are useless to reproduce the bug).
> Comment out the #include <itkImage.h> and everything is good.
>
> ////////////////////////////////////////////////////////////
> ////////////////
> #include <string>
> #include <itkImage.h>
>
> /* Forward declarations of Node and Arc classes since they are
> interdependant */
> class Node;
> class Arc;
>
> /* CLASS : Node
> Class that defines a node or summit for the graph
> */
> class Node
> {
> public:
> Node();
> Node(unsigned int NodeID);
> Node(unsigned int NodeID, int NodeLabel);
> Node(unsigned int NodeID, int NodeLabel, std::string NodeName);
> virtual ~Node();
>
> //Add an outgoing arc
> (27) void AddArc(Arc* OutwardArc);
>
> //Get/set the first outward arc
> (30) Arc* GetFirstOutwardArc();
> (31) void SetFirstOutwardArc(Arc* FirstArc);
>
> //Get/set the node ID
> unsigned int GetNodeID();
> void SetNodeID(unsigned int ID);
>
> //Get the number of arc that exit this node
> unsigned int GetArcCount();
>
> //Get/set the node name
> std::string GetNodeName();
> void SetNodeName(std::string InputName);
>
> //Get/set the node label
> float GetNodeLabel();
> void SetNodeLabel(float InputLabel);
>
> protected:
> (49) Arc* m_FirstOutwardArc;
> unsigned int m_ArcCount;
> unsigned int m_NodeID;
> std::string m_NodeName;
> float m_NodeLabel;
> };
>
> /* CLASS : Arc
> Defines a directionnal edge for graphs
> Each arc strictly have a starting and ending node
> */
> class Arc
> {
> public:
> Arc();
> Arc(Node* StartingNode, Node* EndingNode);
> virtual ~Arc();
>
> //Get/set the starting node
> Node* GetStartNode();
> void SetStartNode(Node* StartingNode);
>
> //Get/set the ending node
> Node* GetEndNode();
> void SetEndNode(Node* EndingNode);
>
> //Get/set the next arc originating from the same node
> virtual Arc* GetNextArc();
> virtual void SetNextArc(Arc* NextArc);
>
> protected:
> Node* m_StartNode;
> Node* m_EndNode;
>
> private:
> Arc* m_NextArcFromSameNode;
>
> };
>
> Tim
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20171121/8d1af93d/attachment-0001.html>
More information about the Community
mailing list