Unresolved Externals LNK2001
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Unresolved Externals LNK2001

  1. #1
    Join Date
    Dec 2010
    Posts
    610

    Unresolved Externals LNK2001

    Hi,
    I have written a small piece of code which mostly duplicated from another
    project. But I didn't understand why they have unresolved externals errors
    while I have defined them in the class.
    Any help would be greatly appreciated
    Thanks
    Jack

    OgreApp.h
    Code:
    #ifndef __OgreApp_h_
    #define __OgreApp_h_
    
    #include "BaseApplication.h"
    #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
    #include "../res/resource.h"
    #endif
    
    #include "OgreRecastDefinitions.h"
    #include "OgreRecast.h"
    #include "OgreDetourCrowd.h"
    #include "Character.h"
    #include "OgreDetourTileCache.h"
    #include "Obstacle.h"
    
    
    class OgreApp : public BaseApplication
    {
    public:
        OgreApp(void);
        virtual ~OgreApp(void);
    //...//
        enum QueryFlags {
           DEFAULT_MASK = 1u<<0,
           NAVMESH_MASK = 1u<<1,
           OBSTACLE_MASK= 1u<<2
        };
    
        /**
          * Set to true to draw visual debug clues related to Recast/Detour navigation
          **/
        static bool DEBUG_DRAW;
    
        /**
          * Set to true to use animated human characters, otherwise test cylinders will
          * be used to represent agents.
          **/
        static bool HUMAN_CHARACTERS;
    
        /**
          * Place obstacles in the scene as separate meshes.
          **/
        static bool OBSTACLES;
    
        /**
          * Determines whether demo app will build simple single navmesh,
          * or build a tiled navmesh using detourTileCache that supports temp obstacles.
          **/
        static bool SINGLE_NAVMESH;
    
        /**
          * Determines whether also dungeon mesh will be queried when clicking to set
          * begin position or destination.
          * Nearest point to navmesh within certain bounds will be found.
          * Set to false to only query points exactly on the navmesh.
          **/
        static bool RAYCAST_SCENE;
    
        /**
          * Determines whether agent steering mode of the demo will use a temp obstacle.
          * Set to false to steer an agent in the crowd instead.
          * Setting to true only has effect when SINGLE_NAVMESH is false.
          **/
        static bool TEMP_OBSTACLE_STEERING;
    
        /**
          * Determines whether the temporary obstacle placing demo places convex shapes
          * on the navmesh.
          * Set to true to place boxes, set to false to place standard temporary obstacles
          * (simple cylinders).
          **/
        static bool COMPLEX_OBSTACLES;
    
        /**
          * Determines whether terrain demo will be shown or a demo in an interior dungeon
          * scene.
          **/
        static bool TERRAIN;
    
        /**
          * Determines whether paged crowds demo will be shown. If true the paged demo will
          * run, if false TERRAIN determines whether terrain or dungeon demo will be run.
          **/
        static bool PAGED;
    
    //...//
    
      
    
     };
    
    #endif // #ifndef __OgreApp_h_
    Code:
    Error	1	error LNK2001: unresolved external symbol "public: static bool OgreApp::HUMAN_CHARACTERS" (?HUMAN_CHARACTERS@OgreApp@@2_NA)	E:\Jacky\Documents\Visual Studio 2010\Projects\OgreApp\OgreApp\OgreRecastPagedCrowdApplication.obj	OgreApp
    Error	2	error LNK2001: unresolved external symbol "public: static bool OgreApp::HUMAN_CHARACTERS" (?HUMAN_CHARACTERS@OgreApp@@2_NA)	E:\Jacky\Documents\Visual Studio 2010\Projects\OgreApp\OgreApp\OgreRecastTerrainApplication.obj	OgreApp
    Error	3	error LNK2019: unresolved external symbol "public: static bool OgreApp::HUMAN_CHARACTERS" (?HUMAN_CHARACTERS@OgreApp@@2_NA) referenced in function "public: __thiscall OgreApp::OgreApp(void)" (??0OgreApp@@QAE@XZ)	E:\Jacky\Documents\Visual Studio 2010\Projects\OgreApp\OgreApp\OgreApp.obj	OgreApp
    Error	4	error LNK2001: unresolved external symbol "public: static bool OgreApp::SINGLE_NAVMESH" (?SINGLE_NAVMESH@OgreApp@@2_NA)	E:\Jacky\Documents\Visual Studio 2010\Projects\OgreApp\OgreApp\OgreRecastTerrainApplication.obj	OgreApp
    Error	5	error LNK2001: unresolved external symbol "public: static bool OgreApp::SINGLE_NAVMESH" (?SINGLE_NAVMESH@OgreApp@@2_NA)	E:\Jacky\Documents\Visual Studio 2010\Projects\OgreApp\OgreApp\OgreApp.obj	OgreApp
    Error	6	error LNK2001: unresolved external symbol "public: static bool OgreApp::RAYCAST_SCENE" (?RAYCAST_SCENE@OgreApp@@2_NA)	E:\Jacky\Documents\Visual Studio 2010\Projects\OgreApp\OgreApp\OgreRecastTerrainApplication.obj	OgreApp
    Error	7	error LNK2001: unresolved external symbol "public: static bool OgreApp::RAYCAST_SCENE" (?RAYCAST_SCENE@OgreApp@@2_NA)	E:\Jacky\Documents\Visual Studio 2010\Projects\OgreApp\OgreApp\OgreApp.obj	OgreApp
    Error	8	error LNK2001: unresolved external symbol "public: static bool OgreApp::COMPLEX_OBSTACLES" (?COMPLEX_OBSTACLES@OgreApp@@2_NA)	E:\Jacky\Documents\Visual Studio 2010\Projects\OgreApp\OgreApp\OgreApp.obj	OgreApp
    Error	9	error LNK2001: unresolved external symbol "public: static bool OgreApp::TEMP_OBSTACLE_STEERING" (?TEMP_OBSTACLE_STEERING@OgreApp@@2_NA)	E:\Jacky\Documents\Visual Studio 2010\Projects\OgreApp\OgreApp\OgreApp.obj	OgreApp
    Error	10	error LNK2001: unresolved external symbol "public: static bool OgreApp::PAGED" (?PAGED@OgreApp@@2_NA)	E:\Jacky\Documents\Visual Studio 2010\Projects\OgreApp\OgreApp\OgreApp.obj	OgreApp
    Error	11	error LNK2001: unresolved external symbol "public: static bool OgreApp::TERRAIN" (?TERRAIN@OgreApp@@2_NA)	E:\Jacky\Documents\Visual Studio 2010\Projects\OgreApp\OgreApp\OgreApp.obj	OgreApp
    Error	12	error LNK2001: unresolved external symbol "public: static bool OgreApp::OBSTACLES" (?OBSTACLES@OgreApp@@2_NA)	E:\Jacky\Documents\Visual Studio 2010\Projects\OgreApp\OgreApp\OgreApp.obj	OgreApp
    Error	13	error LNK2001: unresolved external symbol "public: static bool OgreApp::DEBUG_DRAW" (?DEBUG_DRAW@OgreApp@@2_NA)	E:\Jacky\Documents\Visual Studio 2010\Projects\OgreApp\OgreApp\OgreApp.obj	OgreApp
    Error	14	error LNK2001: unresolved external symbol "protected: static bool BaseApplication::DISABLE_MOUSE_GRAB" (?DISABLE_MOUSE_GRAB@BaseApplication@@1_NA)	E:\Jacky\Documents\Visual Studio 2010\Projects\OgreApp\OgreApp\OgreApp.obj	OgreApp
    Error	15	error LNK2001: unresolved external symbol "protected: static bool BaseApplication::RESTORE_CONFIG" (?RESTORE_CONFIG@BaseApplication@@1_NA)	E:\Jacky\Documents\Visual Studio 2010\Projects\OgreApp\OgreApp\OgreApp.obj	OgreApp
    Error	16	error LNK1120: 11 unresolved externals	E:\Jacky\Documents\Visual Studio 2010\Projects\OgreApp\OgreApp\bin\Debug\\OgreApp.exe	OgreApp
    Last edited by lucky6969b; May 20th, 2014 at 06:44 AM.

  2. #2
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,393

    Re: Unresolved Externals LNK2001

    Have you linked with the appropriate library .lib files?
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  3. #3
    Join Date
    Dec 2010
    Posts
    610

    Re: Unresolved Externals LNK2001

    Hello,
    I have solved it, it is because I didn't define them in the .cpp file
    Thanks
    Jack

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center