Question

I have one solution with 2 projects in it. (VS2013)

One project is a Direct3D with XAML project, the other is a Static class library.

I have set up project dependencies.

enter image description here

I am wondering if the unresolved external symbols could be anything to do with this.

Here are the errors i'm getting... and i'm finding it hard to understand their meaning

Error   1   error LNK2019: unresolved external symbol "public: __thiscall Game::Model::Input::Keyboard::Keyboard(void)" (??0Keyboard@Input@Model@Game@@QAE@XZ) referenced in function "public: __cdecl Game::App::App(void)" (??0App@Game@@Q$AAA@XZ)    C:\Users\James\Documents\Visual Studio 2013\Projects\Games\Jimmy\Game\App.xaml.obj  Game
Error   2   error LNK2019: unresolved external symbol "public: __thiscall Game::Model::Entities::Player::Player(void)" (??0Player@Entities@Model@Game@@QAE@XZ) referenced in function "public: void __thiscall Game::PlayerRenderer::InstantiateDependantObjects(void)" (?InstantiateDependantObjects@PlayerRenderer@Game@@QAEXXZ)  C:\Users\James\Documents\Visual Studio 2013\Projects\Games\Jimmy\Game\PlayerRenderer.obj    Game
Error   3   error LNK1120: 2 unresolved externals   C:\Users\James\Documents\Visual Studio 2013\Projects\Games\Jimmy\Debug\Game\Game.exe    1   1   Game

This is one part of the code it is struggling with:

Model project

Model\Entities\Keyboard.h

#pragma once

namespace Game
{
    namespace Model
    {
        namespace Input
        {
            class Keyboard
            {
            public:
                Keyboard();

                bool Up;
                bool Down;
                bool Left;
                bool Right;
                bool Space;
                bool Escape;
            };
        }
    }
}

Model\Entities\Keyboard.cpp

#include "pch.h"

#include "Entities\Keyboard.h"

using namespace Game::Model::Input;

Keyboard::Keyboard()
:   Up( FALSE ),
    Down( FALSE ),
    Left( FALSE ),
    Right( FALSE ),
    Space( FALSE ),
    Escape( FALSE )
{}

Game project

Game\App.xaml.h

#pragma once

...
#include "..\Model\Entities\Keyboard.h"    
...

using namespace Game::Model::Input;

namespace Game
{
    ref class App sealed
    {
    public:
        ...    
    private:
        ...         
            Keyboard* keyboard;    
            ...
    };
}

Game\App.xaml.cpp

App::App()
{
    InitializeComponent();
    keyboard = new Keyboard();
    Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
    Resuming += ref new EventHandler<Object^>( this, &App::OnResuming );
}

...

Any ideas?

Was it helpful?

Solution

That dialog doesn't do what you hope it does, you are not actually linking your static library project. It used to in old VS versions before VS2010, now it only sets the build order.

Instead, use Project + Properties, Common Properties, References. Click the Add New Reference button and tick your library project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top