Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to overcome this error...

How to overcome this error...

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelptutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pl_kode
    wrote on last edited by
    #1

    I have a class as...

    class Log
    {public:
    Log(string);
    void InitializeLog(string);
    ...

    class Initialize
    { public:
    Initialize(string);
    void ReadPropfile(string);
    ....
    };
    };

    next I am doin this...

    void Log::InitializeLog(string p_path_name)
    {
    Initialize obj(p_path_name);
    obj.ReadPropfile(p_path_name);
    }
    void Log::Initialize::ReadPropfile(string log_path)
    {....}

    From the main I call...

    Log obj(path); // path is a string
    obj.InitializeLog(path);
    ...

    When I compile I get the following error. How do I get rid of this

    test_utility.obj :error LNK2001: unresolved external symbol "public: __thiscall Log::Log(class std::basic_string,class std::allocator >)" (??0Log@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@
    @std@@@Z)
    properties.obj : error LNK2001: unresolved external symbol "public: __thiscall Log::Initialize::Initialize(class std::basic_string,class std::allocator >)" (??0Initialize@Log@@QAE@V?$basic_string@DU?$char_tra
    its@D@std@@V?$allocator@D@2@@std@@@Z)

    THANKS

    J 1 Reply Last reply
    0
    • P pl_kode

      I have a class as...

      class Log
      {public:
      Log(string);
      void InitializeLog(string);
      ...

      class Initialize
      { public:
      Initialize(string);
      void ReadPropfile(string);
      ....
      };
      };

      next I am doin this...

      void Log::InitializeLog(string p_path_name)
      {
      Initialize obj(p_path_name);
      obj.ReadPropfile(p_path_name);
      }
      void Log::Initialize::ReadPropfile(string log_path)
      {....}

      From the main I call...

      Log obj(path); // path is a string
      obj.InitializeLog(path);
      ...

      When I compile I get the following error. How do I get rid of this

      test_utility.obj :error LNK2001: unresolved external symbol "public: __thiscall Log::Log(class std::basic_string,class std::allocator >)" (??0Log@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@
      @std@@@Z)
      properties.obj : error LNK2001: unresolved external symbol "public: __thiscall Log::Initialize::Initialize(class std::basic_string,class std::allocator >)" (??0Initialize@Log@@QAE@V?$basic_string@DU?$char_tra
      its@D@std@@V?$allocator@D@2@@std@@@Z)

      THANKS

      J Offline
      J Offline
      Jijo Raj
      wrote on last edited by
      #2

      pl_kode wrote:

      class Log {public: Log(string);

      forget to implement constructor for Log? Log::Log(string) ? :)

      pl_kode wrote:

      class Initialize { public: Initialize(string);

      And Initialize::Initialize(string) too? ;) Regards, Jijo.

      _____________________________________________________ http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups