Redefinition and Enumerator

前端 未结 2 878
别跟我提以往
别跟我提以往 2020-12-31 06:34

I\'m having a problem with enumerators. Let\'s not waste anyone\'s time, and get straight to it. The error:

1> forgelib\\include\\forge\\socket.h(79): err         


        
2条回答
  •  说谎
    说谎 (楼主)
    2020-12-31 06:48

    Forge::RAW is ambiguous, it is not knows if this is from which enum type.

    Use this style:

    namespace Forge {
        namespace SocketType {
          enum Values {
            STREAM       = SOCK_STREAM,      // Sequenced, reliable, 2-way
            DGRAM        = SOCK_DGRAM,       // Connectionless, unreliable
            RAW          = SOCK_RAW,         // Raw protocol
            RDM          = SOCK_RDM,         // Reliable-delivered message
            SEQPACKET    = SOCK_SEQPACKET    // Sequenced, reliable, 2-way
          };
        }
        namespace  ProtocolType {
          enum Values {
            IP           = IPPROTO_IP,       // IPv4
            ICMP         = IPPROTO_ICMP,     // Internet Control Messsage Protocol
            IGMP         = IPPROTO_IGMP,     // Internet Group Management Protocol
            GGP          = IPPROTO_GGP,      // Gateway to Gateway Protocol
            TCP          = IPPROTO_TCP,      // Transmission Control Protocol
            PUP          = IPPROTO_PUP,      // PARC Universal Packet Protocol
            UDP          = IPPROTO_UDP,      // User Datagram Protocol
            IDP          = IPPROTO_IDP,      // Xerox NS Protocol
            RAW          = IPPROTO_RAW,      // Raw IP Packets
            IPV6         = IPPROTO_IPV6      // IPv6
          };
        }
    }
    

提交回复
热议问题