.h
#include <windows.h> #include <nb30.h> int Recv(int lana, int lsn, char *buffer, DWORD *len); int Send(int lana, int lsn, char *data, DWORD len); int AddName(int lana, char *name, int *num); int DelName(int lana, char *name); int AddGroupName(int lana, char *name, int *num); int ResetAll(LANA_ENUM *lenum, UCHAR ucMaxSession, UCHAR ucMaxName, BOOL bFirstName); int LanaEnum(LANA_ENUM *lenum); int Hangup(int lana, int lsn); int Cancel(PNCB pncb); int FormatNetbiosName(char *nbname, char *outname);
.cpp
#include "stdafx.h" #include <windows.h> #include <stdio.h> #include <stdlib.h> #include "nbcommon.h" int LanaEnum(LANA_ENUM *lenum) { NCB ncb; ZeroMemory(&ncb,sizeof(NCB)); ncb.ncb_command = NCBENUM; ncb.ncb_buffer = (PUCHAR)lenum; ncb.ncb_length = sizeof(LANA_ENUM); if (Netbios(&ncb) != NRC_GOODRET) { printf("ERROR:Netbios:NCBENUM:%d\n",ncb.ncb_retcode); return ncb.ncb_retcode; } return NRC_GOODRET; }
明明已经包含了头文件,却还是提示无法解析外部符号。神奇,求高手解决
具体的错误代码
1>NetBios测试.obj : error LNK2019: 无法解析的外部符号 _Netbios@4,该符号在函数 “int __cdecl AddGroupName(int,char *,int *)” (?AddGroupName@@YAHHPADPAH@Z) 中被引用
1>D:\C++CODE\NetBios测试\Debug\NetBios测试.exe : fatal error LNK1120: 1 个无法解析的外部命令
解决方案
20
https://msdn.microsoft.com/en-us/library/bb870903(v=vs.85).aspx
看Requirements那里
仅有h不够的,还要有lib
看Requirements那里
仅有h不够的,还要有lib