c语言的编译环境出错怎么办,c程序编译出错,求教怎么回事

首先是sendmail.h文件

#define STMP_SERVER "smtp.exmail.qq.com"

#define LOGIN_NAME "secbot@test.com"

#define LOGIN_PASSOWRD "123456"

#define MAIL_TO "root@test.com"

char* get_local_addr(char* buf, size_t len);

int base64_encode(unsigned char *buf, int nLen, char *pOutBuf, int nBufSize);

void sendemail(char *smtpServer, char *serveruser, char *serverpassword, char *serverip);

int open_socket(struct sockaddr *addr);

然后在sendmail.c里定义了一些函数

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

static char base64_table[64] =

{

'A', 'B', 'C', 'D', 'E', 'F', 'G',

'H', 'I', 'J', 'K', 'L', 'M', 'N',

'O', 'P', 'Q', 'R', 'S', 'T',

'U', 'V', 'W', 'X', 'Y', 'Z',

'a', 'b', 'c', 'd', 'e', 'f', 'g',

'h', 'i', 'j', 'k', 'l', 'm', 'n',

'o', 'p', 'q', 'r', 's', 't',

'u', 'v', 'w', 'x', 'y', 'z',

'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',

'+', '/'

};

//int base64_encode(unsigned char *buf, int nLen, char *pOutBuf, int nBufSize);

省略若干代码

之后再test.c里进行调用

#include "sendmail.h"

#define SERVERNAME "root"

#define SERVERPASSWORD "123456"

int main()

{

sendemail(STMP_SERVER, SERVERNAME, SERVERPASSWORD,NULL);

return 0;

}

编译后报错

[root@ops test]# gcc -o test test.c In file included from test.c:1:

sendmail.h:10: error: expected declaration specifiers or ‘...’ before

‘size_t’ sendmail.h:16: warning: ‘struct sockaddr’ declared inside

parameter list sendmail.h:16: warning: its scope is only this

definition or declaration, which is probably not what you want test.c:

In function ‘main’: test.c:10: error: ‘NULL’ undeclared (first use in

this function) test.c:10: error: (Each undeclared identifier is

reported only once test.c:10: error: for each function it appears in.)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值