What does this mean? Any help appreciated!

Discussion in 'C++' started by pkirk25, Oct 24, 2006.

  1. pkirk25

    pkirk25 Guest

    It looks like the Visuakl Studio Intellisense can see the various
    functions but its compiler cannot. I am well out of my depth with this
    error message.

    report.obj : error LNK2019: unresolved external symbol "private: class
    std::vector<class std::basic_string<char,struct
    std::char_traits<char>,class std::allocator<char> >,class
    std::allocator<class std::basic_string<char,struct
    std::char_traits<char>,class std::allocator<char> > > > __thiscall
    Table::v3_snapshot(class std::basic_string<char,struct
    std::char_traits<char>,class std::allocator<char> >)"
    (?v3_snapshot@Table@@AAE?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@@Z)
    referenced in function "public: class std::vector<class
    std::basic_string<char,struct std::char_traits<char>,class
    std::allocator<char> >,class std::allocator<class
    std::basic_string<char,struct std::char_traits<char>,class
    std::allocator<char> > > > __thiscall Table::snapshot(class
    std::basic_string<char,struct std::char_traits<char>,class
    std::allocator<char> >)"
    (?snapshot@Table@@QAE?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@@Z)

    //tables.h
    public:
    Table(string db_file);
    vector<string> realm_list();
    vector<string> snapshot(string realm);
    int get_item_median(string item_code);
    int get_item_snap(string item_code);
    private:
    bool isLoaded;
    int version_number;
    string get_realm_name(string); // return realm name if one is found
    in string
    vector<string> v4_snapshot(string realm);
    vector<string> v3_snapshot(string realm);

    //tables.cpp
    ....
    #include "tables.h"
    ....
    vector<string> Table::snapshot(string realm)
    {
    vector<string> snapshot;
    if (4 == version_number)
    {
    snapshot = this->v4_snapshot(realm);
    }
    else
    {
    snapshot = this->v3_snapshot(realm);
    }

    return snapshot;

    }
    pkirk25, Oct 24, 2006
    #1
    1. Advertising

  2. pkirk25

    pkirk25 Guest

    Fixed

    nt
    pkirk25, Oct 24, 2006
    #2
    1. Advertising

  3. pkirk25

    Mike Wahler Guest

    "pkirk25" <> wrote in message
    news:...
    > It looks like the Visuakl Studio Intellisense can see the various
    > functions but its compiler cannot. I am well out of my depth with this
    > error message.
    >
    > report.obj : error LNK2019: unresolved external symbol "private: class
    > std::vector<class std::basic_string<char,struct
    > std::char_traits<char>,class std::allocator<char> >,class
    > std::allocator<class std::basic_string<char,struct
    > std::char_traits<char>,class std::allocator<char> > > > __thiscall
    > Table::v3_snapshot(class std::basic_string<char,struct
    > std::char_traits<char>,class std::allocator<char> >)"
    > (?v3_snapshot@Table@@AAE?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@@Z)
    > referenced in function "public: class std::vector<class
    > std::basic_string<char,struct std::char_traits<char>,class
    > std::allocator<char> >,class std::allocator<class
    > std::basic_string<char,struct std::char_traits<char>,class
    > std::allocator<char> > > > __thiscall Table::snapshot(class
    > std::basic_string<char,struct std::char_traits<char>,class
    > std::allocator<char> >)"
    > (?snapshot@Table@@QAE?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@@Z)
    >
    > //tables.h
    > public:
    > Table(string db_file);
    > vector<string> realm_list();
    > vector<string> snapshot(string realm);
    > int get_item_median(string item_code);
    > int get_item_snap(string item_code);
    > private:
    > bool isLoaded;
    > int version_number;
    > string get_realm_name(string); // return realm name if one is found
    > in string
    > vector<string> v4_snapshot(string realm);
    > vector<string> v3_snapshot(string realm);


    Here you promise to the compiler that there exists
    somewhere the definition of a function named
    'Table::v3_snapshot()'. Did you provide one?

    >
    > //tables.cpp
    > ...
    > #include "tables.h"
    > ...
    > vector<string> Table::snapshot(string realm)


    This signature states that this function will return
    an object of type 'vector<string>'

    > {
    > vector<string> snapshot;
    > if (4 == version_number)
    > {
    > snapshot = this->v4_snapshot(realm);


    'snapshot()' is a function. Why are you trying to assign
    something to it?

    > }
    > else
    > {
    > snapshot = this->v3_snapshot(realm);
    > }
    >
    > return snapshot;


    Why are you trying to return a type other than what
    the function is defined to return?
    >
    > }
    >


    -Mike
    Mike Wahler, Oct 24, 2006
    #3
  4. On 24 Oct 2006 06:42:52 -0700, "pkirk25" <> wrote:
    >It looks like the Visuakl Studio Intellisense can see the various
    >functions but its compiler cannot. I am well out of my depth with this
    >error message.


    It probably means that you need to add tables.cpp to your project or
    make file.

    Good luck,
    Roland Pibinger
    Roland Pibinger, Oct 24, 2006
    #4
  5. Mike Wahler wrote:
    > "pkirk25" <> wrote in message
    >> ...
    >> vector<string> Table::snapshot(string realm)

    >
    > This signature states that this function will return
    > an object of type 'vector<string>'
    >
    >> {
    >> vector<string> snapshot;
    >> if (4 == version_number)
    >> {
    >> snapshot = this->v4_snapshot(realm);

    >
    > 'snapshot()' is a function. Why are you trying to assign
    > something to it?



    'snapshot' is also a local variable, hiding the name of the function
    in which it's declared. Look at the first line inside the body of
    this function.

    int foo()
    {
    int foo = 42;
    return foo;
    }

    int main()
    {
    return foo();
    }

    This practice is not recommended, but it's perfectly legal.

    >
    >> }
    >> else
    >> {
    >> snapshot = this->v3_snapshot(realm);
    >> }
    >>
    >> return snapshot;

    >
    > Why are you trying to return a type other than what
    > the function is defined to return?


    Huh?

    >>
    >> }


    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
    Victor Bazarov, Oct 24, 2006
    #5
  6. pkirk25

    pkirk25 Guest

    Re: What does this mean? Any help appreciated!

    My mistake was to have the declarations done but to have the
    implementations under under names. Kicked myself a bit when I saw that
    I had forgotten to rename the fuctions after renaming the declarations.

    Didn't help that the error message is a mouthful and that Intellisense
    seemed to see things that were no longer there but untimately my fault.
    pkirk25, Oct 24, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. m.cantaloupe
    Replies:
    3
    Views:
    338
    m.cantaloupe
    May 14, 2004
  2. JimLad
    Replies:
    5
    Views:
    670
    Pavel Lepin
    Jul 11, 2007
  3. rob lynch
    Replies:
    2
    Views:
    112
    rob lynch
    Mar 10, 2006
  4. Mark
    Replies:
    5
    Views:
    169
    Kyle T. Jones
    Dec 2, 2011
  5. Brian  Corrigan
    Replies:
    2
    Views:
    85
Loading...

Share This Page