Question

I am having difficulty figuring out my unresolved external errors.

I have 2 different solutions that both share a core project. Solution #1 is called SnapGame and Solution #2 is called SnapEditor. The core project is called SnapCore.

My SnapGame solution is a Win32 application. It compiles, references, and links the SnapCore project with no issues.

The SnapEditor solution is a Windows Forms Application. It compiles and references the SnapCore project. However, it will not link with it properly. I get unresolved external errors any time I try to reference anything from the SnapCore project.

The SnapCore project has some GDI+ support classes. All classes in the SnapCore project are under the SnapCore namespace.

Here is the file 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.

Any help would be appreciated.

Était-ce utile?

La solution

If I understand you right, SnapEditor is a managed application. It can't simply refer to a native library, like SnapCore. Use P/Invoke, or write a managed wrapper.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top