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

D

DerekBaker

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

Gives me an 'unresolved external symbol' error.
 
F

Francesco S. Carta

DerekBaker said:
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
 
F

Francesco S. Carta

DerekBaker said:
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 :-(
 
D

DerekBaker

Sam said:
DerekBaker said:
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;
}
 
A

Andrey Tarasevich

DerekBaker said:
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"???
 
D

DerekBaker

Andrey said:
DerekBaker said:
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.
 
J

James Kanze

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.)
 
F

Francesco S. Carta

Francesco S. Carta said:
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 ;-)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,227
Latest member
Daniella65

Latest Threads

Top