解决Pingexample编译错误

本文介绍了一种解决使用EVC进行Ping程序开发时遇到的编译错误的方法。通过引入必要的头文件和链接库,成功解决了未解析外部符号的问题。

直接复制《EVC高级编程及其应用开发》第10章PingEXAMPLE

编译老出现下面错误:

Compiling...
nettest.cpp
Linking...
nettest.obj : error LNK2019: unresolved external symbol IcmpCloseHandle referenced in function "void __cdecl CEPing(class CString,class CListBox *,class CWnd *)" (?CEPing@@YAXVCString@@PAVCListBox@@PAVCWnd@@@Z )
nettest.obj : error LNK2019: unresolved external symbol IcmpSendEcho referenced in function "void __cdecl CEPing(class CString,class CListBox *,class CWnd *)" (?CEPing@@YAXVCString@@PAVCListBox@@PAVCWnd@@@Z )
nettest.obj : error LNK2019: unresolved external symbol IcmpCreateFile referenced in function "void __cdecl CEPing(class CString,class CListBox *,class CWnd *)" (?CEPing@@YAXVCString@@PAVCListBox@@PAVCWnd@@@Z )
ARMV4IRel/701F.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.
Creating browse info file...

xxx.exe - 4 error(s), 0 warning(s)

 

原来就缺一句话:

 

 

// nettest.cpp : implementation file
//

#include "stdafx.h"
#include "701F.h"
#include "nettest.h"

#include <icmpapi.h>
#include <winsock.h>
#include <ipExport.h>


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#pragma comment (lib, "Iphlpapi.lib") //这句话解决了ping编译错误

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值