简体   繁体   English

为64位编译工作的32位.dll错误

[英]Compiling a working 32bit .dll for 64bit, errors

I have with a lot of help put together a 32bit plugin (.dll) for the 32bit Teamspeak program which works great. 我在很多帮助下为32位Teamspeak程序组装了一个32位插件(.dll),效果很好。

People are now asking me to compile this for the 64bit Teamspeak client. 人们现在要我为64位Teamspeak客户端编译此文件。

But........... When I do I get the following errors. 但是……...我在执行以下操作时遇到以下错误。

     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 ==========

A part of the Code... 守则的一部分...

#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;
    }
}

You are getting unresolved external symbols errors. 您得到了无法解决的外部符号错误。

If all those SimConnect_* functions are coming from an external source, you need to link you program with the appropriate import library . 如果所有这些SimConnect_*函数都来自外部资源,则需要使用适当的导入库链接程序。

If you just changed the build configuration from win32 to x64 , it might be the case that these import libraries were not changed into your x64 configuration. 如果只是将构建配置从win32更改为x64 ,则可能是这些导入库未更改为x64配置的情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM