EVC的编译错误,主要是error LNK2019,高手请进,轻松拿分
ps2keybd.obj : error LNK2019: unresolved external symbol "int __cdecl KernelIoControl(unsigned long,void *,unsigned long,void *,unsigned long,unsigned long *)" (?KernelIoControl@@YAHKPAXK0KPAK@Z) referenced in function "public: int __cdecl Ps2Keybd:
:IsrThreadProc(void)" (?IsrThreadProc@Ps2Keybd@@QAAHXZ)
ps2keybd.obj : error LNK2019: unresolved external symbol "int __cdecl InterruptInitialize(unsigned long,void *,void *,unsigned long)" (?InterruptInitialize@@YAHKPAX0K@Z) referenced in function "public: int __cdecl Ps2Keybd::IsrThreadProc(void)" (?Is
rThreadProc@Ps2Keybd@@QAAHXZ)
ps2port.obj : error LNK2019: unresolved external symbol READ_PORT_UCHAR referenced in function "private: bool __cdecl Ps2Port::InputBufPollForEmpty(void)" (?InputBufPollForEmpty@Ps2Port@@AAA_NXZ)
ps2port.obj : error LNK2019: unresolved external symbol WRITE_PORT_UCHAR referenced in function "private: bool __cdecl Ps2Port::EnterWrite(void)" (?EnterWrite@Ps2Port@@AAA_NXZ)
MIPSIIRel/PosArmJz.exe : fatal error LNK1120: 4 unresolved externals
高手们,这些未解决的外部变量我都有定义了啊,怎么还会不认呢?怎么解决啊?
不要乱引用你的头文件啊,主意包含和被包含关系,自己理理啊,问题不大
首先强调一点,这些不是compile error,
而是 link error.
是你缺少包含相应的lib文件
#include "stdafx.h"加在.cpp文件的开始.
too strange.
Can type chinese?
Add follow codes to your *.cpp.
then the first lnk can be cleared.
the last two lnk i can't test, you need to try yourself.
extern "C" __declspec(dllimport)
BOOL KernelIoControl(
DWORD dwIoControlCode,
LPVOID lpInBuf,
DWORD nInBufSize,
LPVOID lpOutBuf,
DWORD nOutBufSize,
LPDWORD lpBytesReturned);
extern "C" __declspec(dllimport)
BOOL InterruptInitialize(
DWORD idInt,
HANDLE hEvent,
LPVOID pvData,
DWORD cbData
);
楼主在写驱动还是应用程序?
如果是驱动,你要把Coredll.lib Link进来,因为KernelIoControl和InterruptInitialize都在这个Lib中。
还有CEDDK.lib也要,READ_PORT_UCHAR和WRITE_PORT_UCHAR在这个Lib中。
如果应用程序,也可以像上面那样做。
但建议还是LoadLibray和GetProcAddress来加载。
KernelIoControl和InterruptInitialize在CoreDll.dll里,另两个不知道在哪个DLL里,你自己找找看。