错误LNK2005和错误LNK2019
error LNK2005 and error LNK2019 in C/C++ mix program
程序有:raw_mouse.h、raw_mous.c RawInputRegistry.h RawInputRegister.cpp和main.cpp
在raw_mouse.h中,
我定义:
typedef WINUSERAPI INT (WINAPI *pGetRawInputDeviceList)(OUT PRAWINPUTDEVICELIST pRawInputDeviceList, IN OUT PINT puiNumDevices, IN UINT cbSize);
void testme();
在raw_mouse.c中,我有:
_RRID = (pRegisterRawInputDevices)GetProcAddress(user32,"RegisterRawInputDevices");
void testme()
{
int a =10;
}
我在raw_mouse.c中包含了raw_mouses.h,在RawInputRegistry.h中也包含了raw_mouse.h,最后在main.cpp 中包含了RawInputRegistry.h
然而,我得到了这些错误:
RawInputRegistry.obj : error LNK2005: "int (__stdcall* _GRID)(struct HRAWINPUT__ *,unsigned int,void *,int *,unsigned int)" (?_GRID@@3P6GHPAUHRAWINPUT__@@IPAXPAHI@ZA) already defined in main.obj
RawInputRegistry.obj : error LNK2019: unresolved external symbol "void __cdecl testme(void)" (?testme@@YAXXZ) referenced in function "protected: __thiscall RawInputEventRegistry::RawInputEventRegistry(void)" (??0RawInputEventRegistry@@IAE@XZ)
不确定我是否应该使用extern"C"来包含raw_mouse.C中的所有代码?
不确定我是否应该使用extern"C"来包含raw_mouse.C中的所有代码?
您必须在raw_mouse.h
文件中放入类似以下内容的s.th.,以使其同时符合c++和c#include
:
#ifndef RAW_MOUSE_H__
#define RAW_MOUSE_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Your C function declarations go here ... */
#ifdef __cplusplus
}
#endif
#endif /* RAW_MOUSE_H__ */
相关文章:
- Visual Studio中的wxwidgets应用程序给出错误"LNK2019 unresolved external symbol"
- 构建 Tensorflow 调试时出现错误LNK2019
- 错误LNK2019未解析的外部符号"public: __thiscall SLinkList<char>::SLinkList<char>(void)"
- Google Test:错误 LNK2019:使用 Visual Studio 2017 与 CMake 进行未解析的外
- Azure IOT 错误LNK2019:函数IoTHubClient_LL_UploadToBlob_step1and2
- C++编译错误LNK2019:未解决的外部符号错误
- 错误 LNK2019: 未解析的外部符号 Visual Studio 2013 与 openCV
- 调用静态方法,收到错误:LNK2019
- nanodbc 错误 LNK2019:未解析的外部符号 - 在基本连接上
- 编译轨道样品时的C 错误-LNK2019未解决的外部符号
- main.obj : 错误 LNK2019: 未解析的外部符号 公共: __cdecl.
- 如何在我的指针和阵列功能中修复未解决的外部错误-LNK2019和LNK1120
- 错误LNK2019:未解决的外部符号模板
- 错误LNK2019:未解决的外部符号-MSVC调试构建功能模板
- 错误 LNK2019:未解析的外部符号"double __cdecl calculateRetail(double,double)"
- 错误 LNK2019:未解析的外部符号"外部"C"此错误是什么?
- 字符串以使用SQLAPI(Visual Studio 2010)时出现错误LNK2019
- 使用继承的编译器错误lnk2019和c4930
- 错误 LNK2019:GPLVM 代码中未解析的外部符号 _lbfgs_
- openCV 243 使用静态库错误LNK2019