gpt4 book ai didi

c++ - Unresolved 链接错误

转载 作者:行者123 更新时间:2023-11-28 00:49:43 27 4
gpt4 key购买 nike

<分区>

我在尝试编译时收到此错误。

error LNK2019: unresolved external symbol "public: void __thiscall Serial::WritePort(char * const)" (?WritePort@Serial@@QAEXQAD@Z) referenced in function "public: void __thiscall CThermotronDlg::OnBnClickedButton2(void)" (?OnBnClickedButton2@CThermotronDlg@@QAEXXZ)

我已经包含了所有必需的头文件,但是当我尝试在我的主 dialog.cpp 中调用我的 WritePort 函数(位于我的 sConfig.cpp 中)时,我收到此链接错误。此外,每个 .cpp 文件都在同一个文件夹中,因此我不会尝试引用不同位置的文件,下面是 WritePort 函数和调用它的 block 。

写端口

void WritePort(char buffer[])
{

HANDLE sSerial = CreateFile(L"COM3",GENERIC_READ|GENERIC_WRITE,0,0,OPEN_EXISTING,0,0);
OpenPort();
DWORD bytes;
WriteFile(sSerial, buffer,sizeof(buffer),&bytes,NULL);
}

阻止

void CThermotronDlg::OnBnClickedButton2()

{

CString str; str.Format(L"%d",Index);
LPTSTR Dwell = new TCHAR[1000];
USES_CONVERSION;
char* buffer =T2A(Dwell);
MyListEx.GetItemText(Index,1,Dwell,1000);

Serial Port;
Port.WritePort(buffer);


AfxMessageBox(Dwell,MB_OK,NULL);

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com