首页
社区
课程
招聘
[旧帖] [求助]一小程序报N多错误 0.00雪花
发表于: 2007-9-8 10:56 4675

[旧帖] [求助]一小程序报N多错误 0.00雪花

2007-9-8 10:56
4675
我写了个 获取同段mac的一个小程序 为什么会报那么多的错???

code :
#include <windows.h>
#include <stdio.h>

#include <Iphlpapi.h>

#pragma comment(lib, "Iphlpapi.lib")
#pragma comment(lib, "WS2_32.lib")
#pragma comment(lib, "WINSOCK.lib")
int GetRemoteMac(unsigned char*remoteMac,char *remoteIP)
{
        WSADATA wsdata;
        ULONG remoteAddr=0,macAddrlen=6;
        unsigned char remoteMacTemp[6]={0};
       
        if(WSAStartup(MAKEWORD(2,1),&wsdata)!=0)
        {
                printf("WSAStartup Error!\r\n");
                return 0;
        }
        remoteAddr=inet_addr(remoteIP);
    if(SendARP(remoteAddr,(unsigned long)NULL,(PULONG)&remoteMacTemp,&macAddrlen)!=NO_ERROR)
        {
                printf("Get Remote MAC failed!\r\n");
                return 0;
        }
        memcpy(remoteMac,remoteMacTemp,6);
        printf("Remote IP:%s MAC:",remoteIP);
        for (int i=0;i<6;i++)
        {
                printf("%.2x",remoteMac[i]);
        }
        printf("\r\n");
        return 1;

}

int main(int argc,char *argv[])
{
        unsigned char remoteMac[6]={0};
        if(!GetRemoteMac(remoteMac,argv[1]))
        {
                printf("GetRemoteMac Error!\r\n");
                return -1;
        }
}

错误:
d:\program files\microsoft visual studio\vc98\include\iphlpapi.h(183) : error C2065: 'PMIB_ICMP_EX' : undeclared identifier
d:\program files\microsoft visual studio\vc98\include\iphlpapi.h(183) : error C2146: syntax error : missing ')' before identifier 'pStats'
d:\program files\microsoft visual studio\vc98\include\iphlpapi.h(183) : warning C4229: anachronism used : modifiers on data are ignored
d:\program files\microsoft visual studio\vc98\include\iphlpapi.h(185) : error C2059: syntax error : ')'
d:\program files\microsoft visual studio\vc98\include\iphlpapi.h(376) : error C2065: 'IP_INTERFACE_NAME_INFO' : undeclared identifier
d:\program files\microsoft visual studio\vc98\include\iphlpapi.h(376) : error C2065: 'ppTable' : undeclared identifier
d:\program files\microsoft visual studio\vc98\include\iphlpapi.h(376) : error C2100: illegal indirection
d:\program files\microsoft visual studio\vc98\include\iphlpapi.h(377) : error C2275: 'PDWORD' : illegal use of this type as an expression
        d:\program files\microsoft visual studio\vc98\include\windef.h(156) : see declaration of 'PDWORD'
d:\program files\microsoft visual studio\vc98\include\iphlpapi.h(377) : error C2146: syntax error : missing ')' before identifier 'pdwCount'
d:\program files\microsoft visual studio\vc98\include\iphlpapi.h(377) : warning C4229: anachronism used : modifiers on data are ignored
d:\program files\microsoft visual studio\vc98\include\iphlpapi.h(377) : error C2078: too many initializers
d:\program files\microsoft visual studio\vc98\include\iphlpapi.h(377) : error C2275: 'PDWORD' : illegal use of this type as an expression
        d:\program files\microsoft visual studio\vc98\include\windef.h(156) : see declaration of 'PDWORD'
d:\program files\microsoft visual studio\vc98\include\iphlpapi.h(381) : error C2059: syntax error : ')'

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
免费 0
支持
分享
最新回复 (1)
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
哈哈 自己搞定了 ~
2007-9-8 11:05
0
游客
登录 | 注册 方可回帖
返回