find in a container that is a static member of another class

Discussion in 'C++' started by DerekBaker, Oct 9, 2009.

  1. DerekBaker

    DerekBaker Guest

    vector<string>::iterator it = find(App::LoadOrder.begin(), App::LoadOrder.end(), Masters);

    Gives me an 'unresolved external symbol' error.
    --
    Derek
    DerekBaker, Oct 9, 2009
    #1
    1. Advertising

  2. DerekBaker <> wrote:
    > vector<string>::iterator it = find(App::LoadOrder.begin(), App::LoadOrder.end(), Masters);
    >
    > Gives me an 'unresolved external symbol' error.


    That's simply not enough to raise a meaningful reply - not for/from
    me, at least.

    Post full compilable code showing the same error, make clear what
    compiler you're using and post the exact errors you're getting - and
    post here the exact code you fed to the compiler.

    Having a look to the FAQ 5.8 should help you, too.

    Cheers,
    Francesco

    --
    Francesco S. Carta, http://fscode.altervista.org
    First time here? Read the 'Welcome' and the 'FAQ'
    Welcome: http://www.slack.net/~shiva/welcome.txt
    C++ FAQ: http://www.parashift.com/c -faq-lite
    Francesco S. Carta, Oct 9, 2009
    #2
    1. Advertising

  3. On 9 Ott, 23:14, Sam <> wrote:
    > DerekBaker writes:
    > > vector<string>::iterator it = find(App::LoadOrder.begin(), App::LoadOrder.end(), Masters);

    >
    > > Gives me an 'unresolved external symbol' error.

    >
    > That means that "App::LoadOrder" has not been instantiated in any module.


    Heck, is that really enough to give so a sure answer?

    I really have a lot to learn :-(

    --
    Francesco S. Carta, http://fscode.altervista.org
    Francesco S. Carta, Oct 9, 2009
    #3
  4. DerekBaker

    DerekBaker Guest

    Sam wrote:
    > DerekBaker writes:
    >
    >> vector<string>::iterator it = find(App::LoadOrder.begin(),
    >> App::LoadOrder.end(), Masters);
    >>
    >> Gives me an 'unresolved external symbol' error.

    >
    > That means that "App::LoadOrder" has not been instantiated in any module.
    >


    Even though App's ctor puts data in LoadOrder before creating an object of type ESFileInMem that
    contains the above line of code?

    App::App()
    {
    LoadOrder = GetLoadOrder();

    ESFileInMem Orig("DBSQR - OOO.esp", 0);

    [snipped]

    return;
    }

    --
    Derek
    DerekBaker, Oct 9, 2009
    #4
  5. DerekBaker wrote:
    > vector<string>::iterator it = find(App::LoadOrder.begin(), App::LoadOrder.end(), Masters);
    >
    > Gives me an 'unresolved external symbol' error.


    Sigh... Could you, please, at least tell us _what_ "symbol" was reported
    as "unresolved external symbol"???

    --
    Best regards,
    Andrey Tarasevich
    Andrey Tarasevich, Oct 9, 2009
    #5
  6. DerekBaker

    DerekBaker Guest

    Andrey Tarasevich wrote:
    > DerekBaker wrote:
    >> vector<string>::iterator it = find(App::LoadOrder.begin(),
    >> App::LoadOrder.end(), Masters);
    >>
    >> Gives me an 'unresolved external symbol' error.

    >
    > Sigh... Could you, please, at least tell us _what_ "symbol" was reported
    > as "unresolved external symbol"???
    >


    No need. Hadn't defined (static) LoadOrder in App.cpp.

    --
    Derek
    DerekBaker, Oct 9, 2009
    #6
  7. DerekBaker

    James Kanze Guest

    On Oct 9, 10:46 pm, DerekBaker <> wrote:
    > vector<string>::iterator it = find(App::LoadOrder.begin(), App::LoadOrder.end(), Masters);


    > Gives me an 'unresolved external symbol' error.


    For what symbol? If it's for App::LoadOrder, have you defined
    the object somewhere? (The declaration in the class definition
    is not a definition.)

    --
    James Kanze
    James Kanze, Oct 11, 2009
    #7
  8. On 11 Ott, 19:03, Paavo Helde <> wrote:
    > "Francesco S. Carta" <> kirjutas:
    >
    > > On 9 Ott, 23:14, Sam <> wrote:
    > >> DerekBaker writes:
    > >> > vector<string>::iterator it = find(App::LoadOrder.begin(),
    > >> > App::LoadOrder.end(), Masters);

    >
    > >> > Gives me an 'unresolved external symbol' error.

    >
    > >> That means that "App::LoadOrder" has not been instantiated in any
    > >> module.

    >
    > > Heck, is that really enough to give so a sure answer?

    >
    > It is a very common mistake to forget the definition of a static member
    > object. So given the combination of "static member" and "linker error" this
    > is the most probable cause. The OP could be more helpful, though, at least
    > the error message should have been included.


    You're completely right, however the certainty of the reply did strike
    me bad.

    After all, "Masters" could have been a global std::vector declared as
    extern, and based on the given details, there was a 50% chance of
    pointing out the wrong symbol.

    Now I know, I could have replied "You must have forgotten to define
    App::Loader or/and Masters", but the main point of my first post was
    to push the OP to follow c.l.c++ rules ;-)

    --
    Francesco S. Carta, http://fscode.altervista.org
    Francesco S. Carta, Oct 11, 2009
    #8
    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. E11
    Replies:
    1
    Views:
    4,708
    Thomas Weidenfeller
    Oct 12, 2005
  2. Maitre Bart
    Replies:
    2
    Views:
    510
    Maitre Bart
    Feb 11, 2004
  3. Siemel Naran
    Replies:
    4
    Views:
    785
    Micah Cowan
    Jan 12, 2005
  4. Replies:
    4
    Views:
    784
    Daniel T.
    Feb 16, 2006
  5. dolphin
    Replies:
    3
    Views:
    1,324
    Pete Becker
    Dec 5, 2007
Loading...

Share This Page