一个急需解决的问题。。。。。高分相送

天外飞狐 2003-12-17 03:14:53
我写了一个独立于IP版本的程序,但是找不到应该找到的库函数和结构体:
addrinfo, getaddrinfo(),等

还有一个问题是,出现如下错误该怎么办:
fatal error C1010: unexpected end of file while looking for precompiled header directive
...全文
30 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
sboom 2003-12-29
  • 打赏
  • 举报
回复
错误是没有加文件头,像
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
的东西
天外飞狐 2003-12-29
  • 打赏
  • 举报
回复
但是我的文件里面就是没有啊,我也感到奇怪
wltsui 2003-12-18
  • 打赏
  • 举报
回复
楼主,不可能吧!你的文件中就是没有getaddrinfo的定义吗! 那也太奇怪了!
sharkhuang 2003-12-18
  • 打赏
  • 举报
回复
在你的程序中加了:#include "StdAfx.h"

或者在编译选项中取消用mfc
天外飞狐 2003-12-18
  • 打赏
  • 举报
回复
我的文件中只有这些内容:
/*
** WS2TCPIP.H - WinSock2 Extension for TCP/IP protocols
**
** This file contains TCP/IP specific information for use
** by WinSock2 compatible applications.
**
** To provide the backward compatibility, all the TCP/IP
** specific definitions that were included in the WINSOCK.H
** file are now included in WINSOCK2.H file. WS2TCPIP.H
** file includes only the definitions introduced in the
** "WinSock 2 Protocol-Specific Annex" document.
**
** Rev 0.3 Nov 13, 1995
** Rev 0.4 Dec 15, 1996
*/

#ifndef _WS2TCPIP_H_
#define _WS2TCPIP_H_

/* Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP */

struct ip_mreq {
struct in_addr imr_multiaddr; /* IP multicast address of group */
struct in_addr imr_interface; /* local IP address of interface */
};

/* TCP/IP specific Ioctl codes */

#define SIO_GET_INTERFACE_LIST _IOR('t', 127, u_long)

/* Option to use with [gs]etsockopt at the IPPROTO_IP level */

#define IP_OPTIONS 1 /* set/get IP options */
#define IP_HDRINCL 2 /* header is included with data */
#define IP_TOS 3 /* IP type of service and preced*/
#define IP_TTL 4 /* IP time to live */
#define IP_MULTICAST_IF 9 /* set/get IP multicast i/f */
#define IP_MULTICAST_TTL 10 /* set/get IP multicast ttl */
#define IP_MULTICAST_LOOP 11 /*set/get IP multicast loopback */
#define IP_ADD_MEMBERSHIP 12 /* add an I````P group membership */
#define IP_DROP_MEMBERSHIP 13/* drop an IP group membership */
#define IP_DONTFRAGMENT 14 /* don't fragment IP datagrams */


/* Option to use with [gs]etsockopt at the IPPROTO_UDP level */

#define UDP_NOCHECKSUM 1

/* Option to use with [gs]etsockopt at the IPPROTO_TCP level */

#define TCP_EXPEDITED_1122 0x0002


/* IPv6 definitions */

struct in_addr6 {
u_char s6_addr[16]; /* IPv6 address */
};

struct sockaddr_in6 {
short sin6_family; /* AF_INET6 */
u_short sin6_port; /* Transport level port number */
u_long sin6_flowinfo; /* IPv6 flow information */
struct in_addr6 sin6_addr; /* IPv6 address */
};


typedef struct in_addr6 IN6_ADDR;
wltsui 2003-12-17
  • 打赏
  • 举报
回复
把你的错误信息全部帖出来看看!
wltsui 2003-12-17
  • 打赏
  • 举报
回复
你确定你包含了ws2tcpip.h!

我的ws2tcpip.h这么就有呢:
/*
** WS2TCPIP.H - WinSock2 Extension for TCP/IP protocols
**
** This file contains TCP/IP specific information for use
** by WinSock2 compatible applications.
**
** Copyright (c) Microsoft Corporation. All rights reserved.
**
** To provide the backward compatibility, all the TCP/IP
** specific definitions that were included in the WINSOCK.H
** file are now included in WINSOCK2.H file. WS2TCPIP.H
** file includes only the definitions introduced in the
** "WinSock 2 Protocol-Specific Annex" document.
**
** Rev 0.3 Nov 13, 1995
** Rev 0.4 Dec 15, 1996
*/

#ifndef _WS2TCPIP_H_
#define _WS2TCPIP_H_
.
.
.

/* Flags used in "hints" argument to getaddrinfo() */

#define AI_PASSIVE 0x1 /* Socket address will be used in bind() call */
#define AI_CANONNAME 0x2 /* Return canonical name in first ai_canonname */
#define AI_NUMERICHOST 0x4 /* Nodename must be a numeric address string */

#ifdef __cplusplus
extern "C" {
#endif

WINSOCK_API_LINKAGE
int
WSAAPI
getaddrinfo(
IN const char FAR * nodename,
IN const char FAR * servname,
IN const struct addrinfo FAR * hints,
OUT struct addrinfo FAR * FAR * res
);
天外飞狐 2003-12-17
  • 打赏
  • 举报
回复
要报含什么DLL,编译都不通过,我已经包含了ws2tcpip.h,但是我把这个文件打开,里面也没有addrinfo结构体的定义啊,也没有getaddrinfo()函数
tob 2003-12-17
  • 打赏
  • 举报
回复
你检查一下是不是什么dll没有包含?
wltsui 2003-12-17
  • 打赏
  • 举报
回复
Ws2tcpip.h.
wltsui 2003-12-17
  • 打赏
  • 举报
回复
fatal error C1010
在你的程序中加了:#include "StdAfx.h"

18,356

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 网络编程
c++c语言开发语言 技术论坛(原bbs)
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧