[英]Unresolved external
I am having difficulty figuring out my unresolved external errors. 我很难弄清我未解决的外部错误。
I have 2 different solutions that both share a core project. 我有2个不同的解决方案,都共享一个核心项目。 Solution #1 is called SnapGame and Solution #2 is called SnapEditor. 解决方案1被称为SnapGame,解决方案2被称为SnapEditor。 The core project is called SnapCore. 核心项目称为SnapCore。
My SnapGame solution is a Win32 application. 我的SnapGame解决方案是Win32应用程序。 It compiles, references, and links the SnapCore project with no issues. 它可以毫无问题地编译,引用和链接SnapCore项目。
The SnapEditor solution is a Windows Forms Application. SnapEditor解决方案是Windows窗体应用程序。 It compiles and references the SnapCore project. 它编译并引用SnapCore项目。 However, it will not link with it properly. 但是,它将无法正确链接。 I get unresolved external errors any time I try to reference anything from the SnapCore project. 每当我尝试从SnapCore项目中引用任何内容时,都会遇到无法解决的外部错误。
The SnapCore project has some GDI+ support classes. SnapCore项目具有一些GDI +支持类。 All classes in the SnapCore project are under the SnapCore namespace. SnapCore项目中的所有类都在SnapCore命名空间下。
Here is the file Form1.cpp: 这是文件Form1.cpp:
#include "stdafx.h"
#include "App.h"
#include "Orient.h"
using namespace SnapCore;
using namespace SnapEdit;
void Form1::Init()
{
SnapCore::Orient orient;
new App();
}
Here are the linker errors I get: 这是我得到的链接器错误:
1>Form1.obj : warning LNK4248: unresolved typeref token (01000049) for 'Gdiplus.GpCachedBitmap'; image may not run
1>Form1.obj : error LNK2028: unresolved token (0A000019) "public: __clrcall SnapCore::App::App(void)" (??0App@SnapCore@@$$FQAM@XZ) referenced in function "public: void __clrcall SnapEdit::Form1::InitSnapCore(void)" (?InitSnapCore@Form1@SnapEdit@@$$FQ$AAMXXZ)
1>Form1.obj : error LNK2028: unresolved token (0A00001A) "public: __clrcall SnapCore::Orient::Orient(void)" (??0Orient@SnapCore@@$$FQAM@XZ) referenced in function "public: void __clrcall SnapEdit::Form1::InitSnapCore(void)" (?InitSnapCore@Form1@SnapEdit@@$$FQ$AAMXXZ)
1>Form1.obj : error LNK2019: unresolved external symbol "public: __clrcall SnapCore::App::App(void)" (??0App@SnapCore@@$$FQAM@XZ) referenced in function "public: void __clrcall SnapEdit::Form1::InitSnapCore(void)" (?InitSnapCore@Form1@SnapEdit@@$$FQ$AAMXXZ)
1>Form1.obj : error LNK2019: unresolved external symbol "public: __clrcall SnapCore::Orient::Orient(void)" (??0Orient@SnapCore@@$$FQAM@XZ) referenced in function "public: void __clrcall SnapEdit::Form1::InitSnapCore(void)" (?InitSnapCore@Form1@SnapEdit@@$$FQ$AAMXXZ)
1>C:\Work\PC\SnapEdit\SnapEdit\Debug\SnapEdit.exe : fatal error LNK1120: 4 unresolved externals
I can't figure out why my SnapGame solution links with no troubles, but the SnapEditor solution will not. 我不知道为什么我的SnapGame解决方案可以毫无问题地链接,但是SnapEditor解决方案却不能。
Any help would be appreciated. 任何帮助,将不胜感激。
If I understand you right, SnapEditor is a managed application. 如果我理解正确,则SnapEditor是托管应用程序。 It can't simply refer to a native library, like SnapCore. 它不能简单地引用本机库,例如SnapCore。 Use P/Invoke, or write a managed wrapper . 使用P / Invoke或编写托管包装器 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.