C ++错误LNK2028,LNK2019和LNK1120。它们是什么意思,我该如何解决?
|
我遇到了这三个错误,对我来说它们似乎毫无意义。如果我评论UserInstruction1(P1,P2,P3);在控制台应用程序中,错误消失了。这两个项目都是/ CLR项目。
error LNK2028: unresolved token (0A000930) \"void __cdecl UserInstruction1(double *,wchar_t *,wchar_t *)\" (?UserInstruction1@@$$FYAXPANPA_W1@Z) referenced in function \"int __cdecl wmain(int,wchar_t * * const)\" (?wmain@@$$HYAHHQAPA_W@Z)
error LNK2019: unresolved external symbol \"void __cdecl UserInstruction1(double *,wchar_t *,wchar_t *)\" (?UserInstruction1@@$$FYAXPANPA_W1@Z) referenced in function \"int __cdecl wmain(int,wchar_t * * const)\" (?wmain@@$$HYAHHQAPA_W@Z)
error LNK1120: 2 unresolved externals C:\\Workspace\\Company.Pins\\Bank\\Source\\Debug\\Company.Pins.Bank.Win32Console.exe
//Console App.
#include \"stdafx.h\"
#include \"UInstruction.h\"
int _tmain(int argc, _TCHAR* argv[])
{
auto P2 = (TCHAR *)\"3 Barrowstead\";
TCHAR* P3;
double* P1;
P1[0] = 13;
UserInstruction1(P1, P2, P3);
return 0;
}
-
//UInstruction.h
#ifndef __UINSTRUCTION_H__
#include \"stdafx.h\"
#include \"UInstruction.h\"
#include \"common.h\"
#include <iostream>
#include <stdio.h>
#define PRES_NOCOMMAND_FOUND 2000
#define DllExport __declspec(dllexport)
void ReconcileUHParameter(const double* lpNumeric, TCHAR* lpAlpha1, TCHAR* lpAlpha2);
extern void UserInstruction1(double* lpNumeric, TCHAR* lpAlpha1, TCHAR* lpAlpha2);
#endif
-
//UInstruction.cpp
#include \"stdafx.h\"
#include \"UInstruction.h\"
#include \"common.h\"
#using \"Company.Pins.Bank.Decryption.dll\"
#include <iostream>
#include <stdio.h>
using namespace std;
using namespace System;
using namespace System::Runtime::InteropServices;
CPReSInterfaceApp theApp;
extern void UserInstruction1(
double* lpNumeric,
TCHAR* lpAlpha1, TCHAR* lpAlpha2)
{
//logic goes here
}
没有找到相关结果
已邀请:
2 个回复
净爽
和
和
如果UserInstruction1驻留在Company.Pins.Bank.Win32Console项目使用的Dll中: 确保在stdafx.h中为dll和控制台项目定义:
打开DLL项目的属性,转到\“配置属性\”-> \“ C / C ++ \”-> \“ Preprocessor \”并在\“ Preprocessor Definitions \”中添加一个预处理器符号(如果不包含)有一个)。即我称它为MY_DLL。不要忘记在所有配置中对其进行定义... 确保从DLL导出功能
UInstruction的cpp文件与上面的相同。 编辑:为了完善...
不要忘了从Company.Pins.Bank.Win32Console的属性中,将对Dll项目的引用添加到Company.Pins.Bank.Win32Console \“通用属性\”-> \“框架和引用\”
布埃郝卞簿