藍森林首頁 | 返回主頁 | 本站地圖 | 站內搜索 | 聯繫信箱 |
 您目前的位置:首頁 > 自由軟件 > 技術交流 > 應用編程


    

藍森林 http://www.lslnet.com 2006年6月6日 10:18


奇怪的問題,identify redeclare tcp_send __LINE__

我的頭文件:tcp.h
#ifndef _tcp_h
#define _tcp_h
[i][b]int tcp_send(int sd,void *buf,int len,int timeout);[/b][/i]
#endif
我的源文件:tcp.c
#include "tcp.h"
int tcp_send(int sd,void *buf,int len,int timeout);
{
........
}


在sco 505下cc tcp.c -c
系統error:identify redeclare tcp_send in file tcp.c of line 45

我的程序沒有在其他地方定義這個tcp_send呀,why呢?

奇怪的問題,identify redeclare tcp_send __LINE__

把你的程序貼完整了。

奇怪的問題,identify redeclare tcp_send __LINE__

//tcp.h
#ifndef _TCP_H
#define _TCP_H

int tcp_init(void);
int tcp_connect(char *hostname, int port, int max_wait_seconds);
int tcp_bind(int port);
int tcp_accept(int sd, int max_wait_time);
int tcp_recv(int sd, void *buf, int len, int max_wait_seconds);
int tcp_send(int sd, char *buf, int len, int max_wait_seconds);
int tcp_close(int sd);
int tcp_shut(int sd);

#endif

奇怪的問題,identify redeclare tcp_send __LINE__

int tcp_send(int sd,void *buf,int len,int timeout);
後面怎麼有個分號?
是不是筆誤?

奇怪的問題,identify redeclare tcp_send __LINE__

沒有,我貼上去的筆誤!
//tcp.c
#include "tcp.h"

int tcp_init(void){}
int tcp_connect(char *hostname, int port, int ax_wait_seconds){}
int tcp_bind(int port){}
int tcp_accept(int sd, int max_wait_time){}
int tcp_recv(int sd, void *buf, int len, int max_wait_seconds){}
int tcp_send(int sd, char *buf, int len, int max_wait_seconds){}
int tcp_close(int sd){}
int tcp_shut(int sd){}

奇怪的問題,identify redeclare tcp_send __LINE__

而且我只要把兩個文件中的tcp_send該成不一樣,就沒問題

奇怪的是其他的函數沒有問題?

奇怪的問題,identify redeclare tcp_send __LINE__

這個是你完整的程序嗎?

奇怪的問題,identify redeclare tcp_send __LINE__

我就是這麼編譯,都報tcp_send identify redeclare !

奇怪的問題,identify redeclare tcp_send __LINE__

lenovo:
你在你的編譯環境試一下,如果沒有問題,就是我的sco由問題了!先謝了!

奇怪的問題,identify redeclare tcp_send __LINE__

我在aix5l下,gcc編譯,沒問題。

奇怪的問題,identify redeclare tcp_send __LINE__

好的,謝謝



Copyright © 1999-2000 LSLNET.COM. All rights reserved. 藍森林網站 版權所有。 E-mail : webmaster@lslnet.com