   unresolved external symbol
  I am working on a program out of the "Programming A Multiplayer FPS in DirectX".  Anyway in Chapter 3 I am working on adding states to my engine.  These are basically simple states to test if the State system and the DirectInput are working.  I am getting these errors.1>c:\documents and settings\adam\my documents\3d game engine architecture\chapter 3\test\main.cpp(148) : warning C4309: 'argument' : truncation of constant value1>Linking...1>Main.obj : error LNK2019: unresolved external symbol "public: __thiscall Rendering::Rendering(unsigned long)" (??0Rendering@@QAE@K@Z) referenced in function "void __cdecl StateSetup(void)" (?StateSetup@@YAXXZ)1>Main.obj : error LNK2019: unresolved external symbol "public: __thiscall Sound::Sound(unsigned long)" (??0Sound@@QAE@K@Z) referenced in function "void __cdecl StateSetup(void)" (?StateSetup@@YAXXZ)1>Main.obj : error LNK2019: unresolved external symbol "public: __thiscall GameLogic::GameLogic(unsigned long)" (??0GameLogic@@QAE@K@Z) referenced in function "void __cdecl StateSetup(void)" (?StateSetup@@YAXXZ)1>Main.obj : error LNK2019: unresolved external symbol "public: __thiscall Network::Network(unsigned long)" (??0Network@@QAE@K@Z) referenced in function "void __cdecl StateSetup(void)" (?StateSetup@@YAXXZ)1>Main.obj : error LNK2019: unresolved external symbol "public: __thiscall UserInput::UserInput(unsigned long)" (??0UserInput@@QAE@K@Z) referenced in function "void __cdecl StateSetup(void)" (?StateSetup@@YAXXZ)1>Main.obj : error LNK2019: unresolved external symbol "public: __thiscall TestState::TestState(unsigned long)" (??0TestState@@QAE@K@Z) referenced in function "void __cdecl StateSetup(void)" (?StateSetup@@YAXXZ)1>.\Debug/Test.exe : fatal error LNK1120: 6 unresolved externals//-----------------------------------------------------------------------------// System Includes//-----------------------------------------------------------------------------#include <windows.h>//-----------------------------------------------------------------------------// Engine Includes//-----------------------------------------------------------------------------#include "..\Engine\Engine.h"//Function Templatesvoid CheckKeys();void StateSetup();//State ID Numbers#define TEST_STATE 1#define USER_INPUT 2#define NETWORK 3#define GAME_LOGIC 4#define SOUND 5#define RENDERING 6//-----------------------------------------------------------------------------// Test State Class//-----------------------------------------------------------------------------class TestState : public State{public:TestState(unsigned long id);//-------------------------------------------------------------------------// Update function for the TestState.//-------------------------------------------------------------------------virtual void Update( float elapsed ){CheckKeys();g_engine->WriteToLog("In Test State");};};//-----------------------------------------------------------------------------//F1 User Input//-----------------------------------------------------------------------------class UserInput : public State{public:UserInput(unsigned long id);virtual void Load(){g_engine->WriteToLog("In User Input");}virtual void Update( float elapsed){CheckKeys();}};//------------------------------------------------------------------------------//F2 Network Stateclass Network : public State{public:Network(unsigned long id);virtual void Load(){g_engine->WriteToLog("In Network State");}virtual void Update( float elapsed){CheckKeys();}};//------------------------------------------------------------------------------//F3 Game Logic//------------------------------------------------------------------------------class GameLogic : public State{public:GameLogic(unsigned long id);virtual void Load(){g_engine->WriteToLog("In GameLogic State");}virtual void Update( float elapsed){CheckKeys();}};//-----------------------------------------------------------------------------//F4 Sound State//-----------------------------------------------------------------------------class Sound : public State{public:Sound(unsigned long id);virtual void Load(){g_engine->WriteToLog("In Sound State");}virtual void Update( float elapsed){CheckKeys();}};//-----------------------------------------------------------------------------//F5 Rendering//-----------------------------------------------------------------------------class Rendering : public State{public:Rendering(unsigned long id);virtual void Load(){g_engine->WriteToLog("In Rendering State");}virtual void Update( float elapsed){CheckKeys();}};//-----------------------------------------------------------------------------//Function Check keys//-----------------------------------------------------------------------------//Note this could be added directly to the Run functionvoid CheckKeys(){if(g_engine->GetInput()->GetKeyPress(DIK_Q)){PostQuitMessage(0);}else if(g_engine->GetInput()->GetKeyPress(DIK_F1)){g_engine->ChangeState(USER_INPUT);}else if(g_engine->GetInput()->GetKeyPress(DIK_F2)){g_engine->ChangeState(NETWORK);}else if(g_engine->GetInput()->GetKeyPress(DIK_F3)){g_engine->ChangeState(GAME_LOGIC);}else if(g_engine->GetInput()->GetKeyPress(DIK_F4)){g_engine->ChangeState(SOUND);}else if(g_engine->GetInput()->GetKeyPress(DIK_F5)){g_engine->ChangeState(RENDERING);}else if(g_engine->GetInput()->GetKeyPress(DIK_PAUSE)){g_engine->WriteToLog("Pressed Pause key");g_engine->GetCurrentState()->Load();}}//-----------------------------------------------------------------------------// Application specific state setup.//-----------------------------------------------------------------------------void StateSetup(){//Starts the game in Test Stateg_engine->AddState( new TestState(TEST_STATE), true );g_engine->AddState( new UserInput(USER_INPUT), false);g_engine->AddState( new Network(NETWORK), false);g_engine->AddState( new GameLogic(GAME_LOGIC), false);g_engine->AddState( new Sound(SOUND), false);g_engine->AddState( new Rendering(RENDERING), false);}//-----------------------------------------------------------------------------// Entry point for the application.//-----------------------------------------------------------------------------int WINAPI WinMain( HINSTANCE instance, HINSTANCE prev, LPSTR cmdLine, int cmdShow ){// Create the engine setup structure.EngineSetup setup;setup.instance = instance;setup.name = "Engine Control Test";setup.StateSetup = StateSetup;// Create the engine (using the setup structure), then run it.new Engine( &setup );g_engine->EnableLogging();g_engine->Run();return true;}I think its okay to post this part of it because I wrote almost all of this portion.   
Quote:class Sound : public State{public:Sound(unsigned long id);...This code tells the compiler that the Sound class has a constructor called Sound that takes a unsigned long argument, but it is not defined anywhere.Thats basically what the linker error is telling you.The same is the problem for the other constructors (Rendering, GameLogic ...)Is there a cpp file anywhere that defines these constructors?   ;  I am inheriting from State, do I still need to implement the constructor for each aditional State?  State(unsigned long id){m_id = id;};Quote:Original post by adam23I am inheriting from State, do I still need to implement the constructor for each aditional State?  State(unsigned long id){m_id = id;}Almost. You need to implement the constructors for your new classes since the default constructor isn't sufficient. You declared a constructor -- you have to implement it, too. I'm guessing your constructors would look something like this (you didn't show the declaration for State::State):class UserInput : public State    {    public:   UserInput(unsigned long id) : State( id )   {  // Any additional initialization for UserInput   }    ... ;  Yes, you do.And if the State constructor is of the same form, then you can write:Sound( unsigned long id ) : State( id ) {}[edit] Whoops, too slowjfl.   ;  Thank you guys so much, it worked :)