免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1172 | 回复: 1
打印 上一主题 下一主题

cc编译not ok,CC编译ok,help! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-03-02 18:59 |只看该作者 |倒序浏览
编译命令: cc -o server -xarch=generic64 -D_XPG4_2 -D__EXTENSIONS__ -I. -lsocket -lnsl server.c

错误信息:
"demo.h", line 21: warning: no explicit type given
"demo.h", line 21: syntax error before or at: megaco_sctp_sockaddr_storage_st
"demo.h", line 21: warning: old-style declaration or incorrect type for: megaco_sctp_sockaddr_storage_st
"demo.h", line 22: warning: no explicit type given
"demo.h", line 22: syntax error before or at: megaco_sctp_os_sockaddr_in_st
"demo.h", line 22: warning: old-style declaration or incorrect type for: megaco_sctp_os_sockaddr_in_st
"demo.h", line 23: warning: no explicit type given
"demo.h", line 23: syntax error before or at: megaco_sctp_os_sockaddr_in6_st
"demo.h", line 23: warning: old-style declaration or incorrect type for: megaco_sctp_os_sockaddr_in6_st
"demo.h", line 24: warning: no explicit type given
"demo.h", line 24: syntax error before or at: megaco_sctp_initmsg_st
"demo.h", line 24: warning: old-style declaration or incorrect type for: megaco_sctp_initmsg_st
"server.c", line 34: undefined symbol: sin
"server.c", line 37: undefined symbol: sctp_notification
"server.c", line 37: syntax error before or at: )
"server.c", line 55: warning: improper pointer/integer combination: op "="
"server.c", line 56: left operand of "->" must be pointer to struct/union
cc: acomp failed for server.c

测试程序如下:

###   demo.h   ###
#include <assert.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/socket.h>
#include <sys/stropts.h>
#include <sys/stream.h>
#include <sys/socketvar.h>
#include <sys/sockio.h>
#include <arpa/inet.h>

#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <stropts.h>
#include <stdio.h>
#include <strings.h>
#include <netinet/in.h>
#include <netinet/sctp.h>

#define SCTP_SOCKET socket

typedef sockaddr_storage        megaco_sctp_sockaddr_storage_st;
typedef sockaddr_in             megaco_sctp_os_sockaddr_in_st;
typedef sockaddr_in6            megaco_sctp_os_sockaddr_in6_st;
typedef sctp_initmsg            megaco_sctp_initmsg_st;

###  server.c  ###
#include "demo.h"

#define BUFLEN  100
   int main()
   {   
           struct sctp_event_subscribe event;
           int lfd, cfd;
           int onoff = 1;
           struct sockaddr_in sin[1];

           if ((lfd = SCTP_SOCKET(AF_INET, SOCK_STREAM, IPPROTO_SCTP)) == -1) {
                   perror("socket");
                   exit(1);         
           }
   
           return 0;
    }

望大侠指点,谢谢!

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
2 [报告]
发表于 2006-03-02 20:46 |只看该作者
sockaddr_in 等等那一大堆 struct 前面都要加关键字 struct 的。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP