我有很多帮助为32位Teamspeak程序组合了一个32位插件(.dll),该程序运行良好。
人们现在要求我为64位Teamspeak客户端编译它。
但是........... 当我这样做时,我会收到以下错误。
1>------ Build started: Project: GetFSComFreqs, Configuration: Release x64 ------
Creating library C:\Users\Roo\Desktop\pluginsdk\src\x64\Release\GetFSComFreqs.lib and object C:\Users\Roo\Desktop\pluginsdk\src\x64\Release\GetFSComFreqs.exp
GetFSComFreqs.obj : error LNK2019: unresolved external symbol SimConnect_Close referenced in function "void __cdecl DLLStop(void)" (?DLLStop@@YAXXZ)
GetFSComFreqs.obj : error LNK2019: unresolved external symbol SimConnect_Open referenced in function "void __cdecl DLLStart(void)" (?DLLStart@@YAXXZ)
SimConnectProcs.obj : error LNK2001: unresolved external symbol SimConnect_Open
GetFSComFreqs.obj : error LNK2019: unresolved external symbol SimConnect_CallDispatch referenced in function "void __cdecl DLLStart(void)" (?DLLStart@@YAXXZ)
SimConnectProcs.obj : error LNK2019: unresolved external symbol SimConnect_AddToDataDefinition referenced in function "void __cdecl OnRecvOpen(struct SIMCONNECT_RECV_OPEN *,unsigned long,void *)" (?OnRecvOpen@@YAXPEAUSIMCONNECT_RECV_OPEN@@KPEAX@Z)
SimConnectProcs.obj : error LNK2019: unresolved external symbol SimConnect_RequestDataOnSimObject referenced in function "void __cdecl OnRecvOpen(struct SIMCONNECT_RECV_OPEN *,unsigned long,void *)" (?OnRecvOpen@@YAXPEAUSIMCONNECT_RECV_OPEN@@KPEAX@Z)
SimConnectProcs.obj : error LNK2019: unresolved external symbol SimConnect_GetNextDispatch referenced in function "unsigned int __cdecl MessageRoutine(void *)" (?MessageRoutine@@YAIPEAX@Z)
C:\Users\Roo\Desktop\pluginsdk\src\x64\Release\GetFSComFreqs.dll : fatal error LNK1120: 6 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
守则的一部分......
#include "stdafx.h"
#define FSAPI __stdcall
HANDLE hSimConnect = 0;
HANDLE hMsgThread = 0;
HINSTANCE ThisModule = 0;
HRESULT hr = 0;
char ThisModuleName[MAX_PATH];
void FSAPI StartSimConnect()
{
if (NULL == hSimConnect)
{
GetModuleFileName(ThisModule, ThisModuleName, MAX_PATH);
hr = SimConnect_Open(&hSimConnect, ThisModuleName, NULL, NULL, NULL, 0);
hr = SimConnect_CallDispatch(hSimConnect, SimConnectDispatch, NULL);
if (FAILED(hr)) hSimConnect = 0;
else hMsgThread = (HANDLE)_beginthreadex(NULL, NULL, MessageRoutine, NULL, NULL, NULL);
}
}
void FSAPI StopSimConnect()
{
if (NULL != hSimConnect)
{
hr = SimConnect_Close(hSimConnect);
hSimConnect = 0;
}
}
int main() {}
void FSAPI DLLStart(void)
{
if (NULL == hSimConnect)
{
GetModuleFileName(ThisModule, ThisModuleName, MAX_PATH);
hr = SimConnect_Open(&hSimConnect, ThisModuleName, NULL, NULL, NULL, 0);
hr = SimConnect_CallDispatch(hSimConnect, SimConnectDispatch, NULL);
if (FAILED(hr)) hSimConnect = 0;
else hMsgThread = (HANDLE)_beginthreadex(NULL, NULL, MessageRoutine, NULL, NULL, NULL);
}
}
void FSAPI DLLStop(void)
{
if (NULL != hSimConnect)
{
hr = SimConnect_Close(hSimConnect);
hSimConnect = 0;
}
}
答案 0 :(得分:0)
您收到未解决的外部符号错误。
如果所有这些SimConnect_*
函数都来自外部源,则需要将程序与相应的导入库链接。
如果您刚刚将构建配置从 win32 更改为 x64 ,则可能是这些导入库未更改为您的 x64 配置。