c++ - Errors when compiling a project with Cygwin -
i'm trying compile project (https://github.com/alfchen/qoetrafficanalyzer) in windows 7 using cygwin. in linux have no problem, need in windows. installed winpcap following steps included here: help installing libpcap on cygwin. however, i'm still having problems. know project uses arpa/inet.h , under windows have use winsock2.h, changing not solve anything. right i'm having following error. hope can me.
$ make g++ -c tcpflowstat.cpp -wno-deprecated -i include/ -o tcpflowstat.o tcpflowstat.cpp: en la función miembro static ‘static int tcpflowstat::isnewflow(std::string, std::string, tcphdr*)’: tcpflowstat.cpp:33:17: error: ‘struct tcphdr’ has no member named ‘syn’ if (tcphdr->syn==1 && tcphdr->ack!=1) return 1; ^ tcpflowstat.cpp:33:35: error: ‘struct tcphdr’ has no member named ‘ack’ if (tcphdr->syn==1 && tcphdr->ack!=1) return 1; ^ tcpflowstat.cpp: en la función miembro ‘int tcpflowstat::ismypacket(std::string, std::string, tcphdr*)’: tcpflowstat.cpp:39:31: error: ‘struct tcphdr’ has no member named ‘source’ && cltport==tcphdr->source && svrport==tcphdr->dest) \ ^ tcpflowstat.cpp:39:58: error: ‘struct tcphdr’ has no member named ‘dest’ && cltport==tcphdr->source && svrport==tcphdr->dest) \ ^ tcpflowstat.cpp:42:31: error: ‘struct tcphdr’ has no member named ‘dest’ && cltport==tcphdr->dest && svrport==tcphdr->source)) return 0; ^ tcpflowstat.cpp:42:56: error: ‘struct tcphdr’ has no member named ‘source’ && cltport==tcphdr->dest && svrport==tcphdr->source)) return 0; ^ tcpflowstat.cpp:43:59: error: ‘struct tcphdr’ has no member named ‘source’ int pktdir=getpacketdirection(ip_src, ip_dst, tcphdr->source, tcphdr->dest); ^ tcpflowstat.cpp:43:75: error: ‘struct tcphdr’ has no member named ‘dest’ int pktdir=getpacketdirection(ip_src, ip_dst, tcphdr->source, tcphdr->dest); ^ tcpflowstat.cpp: en la función miembro ‘void tcpflowstat::addpacket(std::string, std::string, int, tcphdr*, double, int, bool)’: tcpflowstat.cpp:109:59: error: ‘struct tcphdr’ has no member named ‘source’ int pktdir=getpacketdirection(ip_src, ip_dst, tcphdr->source, tcphdr->dest); ^ tcpflowstat.cpp:109:75: error: ‘struct tcphdr’ has no member named ‘dest’ int pktdir=getpacketdirection(ip_src, ip_dst, tcphdr->source, tcphdr->dest); ^ tcpflowstat.cpp:110:41: error: ‘struct tcphdr’ has no member named ‘doff’ int tcpdatalen=ippayloadlen-tcphdr->doff*4; ^ tcpflowstat.cpp:174:25: error: ‘struct tcphdr’ has no member named ‘syn’ if (tcphdr->syn==1 && tcphdr->ack!=1){ ^ tcpflowstat.cpp:174:43: error: ‘struct tcphdr’ has no member named ‘ack’ if (tcphdr->syn==1 && tcphdr->ack!=1){ ^ tcpflowstat.cpp:178:33: error: ‘struct tcphdr’ has no member named ‘source’ cltport=tcphdr->source; ^ tcpflowstat.cpp:179:33: error: ‘struct tcphdr’ has no member named ‘dest’ svrport=tcphdr->dest; ^ tcpflowstat.cpp:180:32: error: ‘struct tcphdr’ has no member named ‘seq’ cltseq=tcphdr->seq; ^ tcpflowstat.cpp:181:35: error: ‘struct tcphdr’ has no member named ‘seq’ svrackseq=tcphdr->seq+1; cltinitseq=tcphdr->seq+1; ^ tcpflowstat.cpp:181:61: error: ‘struct tcphdr’ has no member named ‘seq’ svrackseq=tcphdr->seq+1; cltinitseq=tcphdr->seq+1; ^ tcpflowstat.cpp:192:25: error: ‘struct tcphdr’ has no member named ‘syn’ if (tcphdr->syn==1 && tcphdr->ack==1 && tcphdr->ack_seq==svrackseq){ ^ tcpflowstat.cpp:192:43: error: ‘struct tcphdr’ has no member named ‘ack’ if (tcphdr->syn==1 && tcphdr->ack==1 && tcphdr->ack_seq==svrackseq){ ^ tcpflowstat.cpp:192:61: error: ‘struct tcphdr’ has no member named ‘ack_seq’ if (tcphdr->syn==1 && tcphdr->ack==1 && tcphdr->ack_seq==svrackseq){ ^ tcpflowstat.cpp:195:32: error: ‘struct tcphdr’ has no member named ‘seq’ svrseq=tcphdr->seq; ^ tcpflowstat.cpp:196:35: error: ‘struct tcphdr’ has no member named ‘seq’ cltackseq=tcphdr->seq+1; svrinitseq=tcphdr->seq+1; ^ tcpflowstat.cpp:196:61: error: ‘struct tcphdr’ has no member named ‘seq’ cltackseq=tcphdr->seq+1; svrinitseq=tcphdr->seq+1; ^ tcpflowstat.cpp:197:32: error: ‘struct tcphdr’ has no member named ‘ack_seq’ cltseq=tcphdr->ack_seq; ^ tcpflowstat.cpp:202:30: error: ‘struct tcphdr’ has no member named ‘syn’ else if (tcphdr->syn==1 && tcphdr->ack!=1 && pktdir==pktsender_svr){ ^ tcpflowstat.cpp:202:48: error: ‘struct tcphdr’ has no member named ‘ack’ else if (tcphdr->syn==1 && tcphdr->ack!=1 && pktdir==pktsender_svr){ ^ tcpflowstat.cpp:205:32: error: ‘struct tcphdr’ has no member named ‘seq’ svrseq=tcphdr->seq; ^ tcpflowstat.cpp:206:35: error: ‘struct tcphdr’ has no member named ‘seq’ cltackseq=tcphdr->seq+1; svrinitseq=tcphdr->seq+1; ^ tcpflowstat.cpp:206:61: error: ‘struct tcphdr’ has no member named ‘seq’ cltackseq=tcphdr->seq+1; svrinitseq=tcphdr->seq+1; ^ tcpflowstat.cpp:211:30: error: ‘struct tcphdr’ has no member named ‘fin’ else if (tcphdr->fin==1 || tcphdr->rst==1){ ^ tcpflowstat.cpp:211:48: error: ‘struct tcphdr’ has no member named ‘rst’ else if (tcphdr->fin==1 || tcphdr->rst==1){ ^ tcpflowstat.cpp:220:25: error: ‘struct tcphdr’ has no member named ‘syn’ if (tcphdr->syn!=1 &&tcphdr->ack==1 && tcphdr->seq==cltseq && tcphdr->ack_seq==cltackseq){ ^ tcpflowstat.cpp:220:42: error: ‘struct tcphdr’ has no member named ‘ack’ if (tcphdr->syn!=1 &&tcphdr->ack==1 && tcphdr->seq==cltseq && tcphdr->ack_seq==cltackseq){ ^ tcpflowstat.cpp:220:60: error: ‘struct tcphdr’ has no member named ‘seq’ if (tcphdr->syn!=1 &&tcphdr->ack==1 && tcphdr->seq==cltseq && tcphdr->ack_seq==cltackseq){ ^ tcpflowstat.cpp:220:83: error: ‘struct tcphdr’ has no member named ‘ack_seq’ if (tcphdr->syn!=1 &&tcphdr->ack==1 && tcphdr->seq==cltseq && tcphdr->ack_seq==cltackseq){ ^ tcpflowstat.cpp:231:67: error: ‘struct tcphdr’ has no member named ‘source’ pktdir=getpacketdirection(ip_src, ip_dst, tcphdr->source, tcphdr->dest); ^ tcpflowstat.cpp:231:83: error: ‘struct tcphdr’ has no member named ‘dest’ pktdir=getpacketdirection(ip_src, ip_dst, tcphdr->source, tcphdr->dest); ^ tcpflowstat.cpp:234:36: error: ‘struct tcphdr’ has no member named ‘seq’ cltseq=tcphdr->seq+tcpdatalen; ^ tcpflowstat.cpp:235:39: error: ‘struct tcphdr’ has no member named ‘ack_seq’ cltackseq=tcphdr->ack_seq; ^ tcpflowstat.cpp:236:36: error: ‘struct tcphdr’ has no member named ‘ack_seq’ svrseq=tcphdr->ack_seq; ^ tcpflowstat.cpp:239:36: error: ‘struct tcphdr’ has no member named ‘seq’ svrseq=tcphdr->seq+tcpdatalen; ^ tcpflowstat.cpp:240:39: error: ‘struct tcphdr’ has no member named ‘ack_seq’ svrackseq=tcphdr->ack_seq; ^ tcpflowstat.cpp:241:36: error: ‘struct tcphdr’ has no member named ‘ack_seq’ cltseq=tcphdr->ack_seq; ^ tcpflowstat.cpp:248:25: error: ‘struct tcphdr’ has no member named ‘syn’ if (tcphdr->syn==1 && tcphdr->ack==1 && simulsyn==1){ ^ tcpflowstat.cpp:248:43: error: ‘struct tcphdr’ has no member named ‘ack’ if (tcphdr->syn==1 && tcphdr->ack==1 && simulsyn==1){ ^ tcpflowstat.cpp:250:54: error: ‘struct tcphdr’ has no member named ‘seq’ if (pktdir==pktsender_clt && tcphdr->seq==cltseq && tcphdr->ack_seq==cltackseq){ ^ tcpflowstat.cpp:250:77: error: ‘struct tcphdr’ has no member named ‘ack_seq’ if (pktdir==pktsender_clt && tcphdr->seq==cltseq && tcphdr->ack_seq==cltackseq){ ^ tcpflowstat.cpp:257:54: error: ‘struct tcphdr’ has no member named ‘seq’ if (pktdir==pktsender_svr && tcphdr->seq==svrseq && tcphdr->ack_seq==svrackseq){ ^ tcpflowstat.cpp:257:77: error: ‘struct tcphdr’ has no member named ‘ack_seq’ if (pktdir==pktsender_svr && tcphdr->seq==svrseq && tcphdr->ack_seq==svrackseq){ ^ tcpflowstat.cpp:277:25: error: ‘struct tcphdr’ has no member named ‘syn’ if (tcphdr->syn!=1) { ^ tcpflowstat.cpp:280:33: error: ‘struct tcphdr’ has no member named ‘seq’ if (tcphdr->seq > cltseq){ ^ tcpflowstat.cpp:284:33: error: ‘struct tcphdr’ has no member named ‘seq’ if (tcphdr->seq < cltseq){ ^ tcpflowstat.cpp:286:50: error: ‘struct tcphdr’ has no member named ‘seq’ int retxb=cltseq-tcphdr->seq; ^ tcpflowstat.cpp:296:33: error: ‘struct tcphdr’ has no member named ‘seq’ if (tcphdr->seq+tcpdatalen > cltseq) { ^ tcpflowstat.cpp:297:40: error: ‘struct tcphdr’ has no member named ‘seq’ cltseq=tcphdr->seq+tcpdatalen; ^ tcpflowstat.cpp:300:33: error: ‘struct tcphdr’ has no member named ‘ack_seq’ if (tcphdr->ack_seq >= cltackseq) { ^ tcpflowstat.cpp:301:43: error: ‘struct tcphdr’ has no member named ‘ack_seq’ cltackseq=tcphdr->ack_seq; ^ tcpflowstat.cpp:309:33: error: ‘struct tcphdr’ has no member named ‘seq’ if (tcphdr->seq > svrseq){ ^ tcpflowstat.cpp:313:33: error: ‘struct tcphdr’ has no member named ‘seq’ if (tcphdr->seq < svrseq) { ^ tcpflowstat.cpp:314:50: error: ‘struct tcphdr’ has no member named ‘seq’ int retxb=svrseq-tcphdr->seq; ^ tcpflowstat.cpp:325:33: error: ‘struct tcphdr’ has no member named ‘seq’ if (tcphdr->seq+tcpdatalen > svrseq) { ^ tcpflowstat.cpp:326:40: error: ‘struct tcphdr’ has no member named ‘seq’ svrseq=tcphdr->seq+tcpdatalen; ^ tcpflowstat.cpp:330:33: error: ‘struct tcphdr’ has no member named ‘ack_seq’ if (tcphdr->ack_seq >= svrackseq) { ^ tcpflowstat.cpp:331:43: error: ‘struct tcphdr’ has no member named ‘ack_seq’ svrackseq=tcphdr->ack_seq; ^ tcpflowstat.cpp:337:29: error: ‘struct tcphdr’ has no member named ‘fin’ if (tcphdr->fin==1 || tcphdr->rst==1){ ^ tcpflowstat.cpp:337:47: error: ‘struct tcphdr’ has no member named ‘rst’ if (tcphdr->fin==1 || tcphdr->rst==1){ ^ make: *** [makefile:25: tcpflowstat.o] error 1
on cygwin structure defined on /usr/include/netinet/tcp.h
contents is:
struct tcphdr { u_int16_t th_sport; /* source port */ u_int16_t th_dport; /* destination port */ tcp_seq th_seq; /* sequence number */ tcp_seq th_ack; /* acknowledgement number */ #if __byte_order == __little_endian unsigned int th_x2:4, /* (unused) */ th_off:4; /* data offset */ #endif #if __byte_order == __big_endian unsigned int th_off:4, /* data offset */ th_x2:4; /* (unused) */ #endif u_int8_t th_flags; #define th_fin 0x01 #define th_syn 0x02 #define th_rst 0x04 #define th_push 0x08 #define th_ack 0x10 #define th_urg 0x20 #define th_flags (th_fin|th_syn|th_rst|th_ack|th_urg) u_int16_t th_win; /* window */ u_int16_t th_sum; /* checksum */ u_int16_t th_urp; /* urgent pointer */ };
be aware of cygwin internal taken bsd , not linux , in case 2 structures not match.
Comments
Post a Comment