views:

75

answers:

2

hey, sorry for this but i'm trying to figure out what's the problem for too long, if you can spot a clue from this long error message i will be thankful

Error   6   
error LNK2019: unresolved external symbol "public: __thiscall Adjutancy::Adjutancy(class std::set<class Vehicle *,struct CompareCatId,class std::allocator<class Vehicle *> > *,class std::vector<class std::vector<class Distance *,class std::allocator<class Distance *> >,class std::allocator<class std::vector<class Distance *,class std::allocator<class Distance *> > > > *,class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class Base *,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class Base *> > > *,class std::map<int,class City *,struct std::less<int>,class std::allocator<struct std::pair<int const ,class City *> > > *)" (??0Adjutancy@@QAE@PAV?$set@PAVVehicle@@UCompareCatId@@V?$allocator@PAVVehicle@@@std@@@std@@PAV?$vector@V?$vector@PAVDistance@@V?$allocator@PAVDistance@@@std@@@std@@V?$allocator@V?$vector@PAVDistance@@V?$allocator@PAVDistance@@@std@@@std@@@2@@2@PAV?$map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAVBase@@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAVBase@@@std@@@2@@2@PAV?$map@HPAVCity@@U?$less@H@std@@V?$allocator@U?$pair@$$CBHPAVCity@@@std@@@3@@2@@Z) referenced in function "private: class Adjutancy * __thiscall Reader::ReadFromFile(char * * const)" (?ReadFromFile@Reader@@AAEPAVAdjutancy@@QAPAD@Z)   
C:\Users\Roy\documents\visual studio 2010\Projects\HomeWork5\HomeWork5\Reader.obj
+3  A: 

Adjutancy's constructor is not being compiled. You may not be compiling a source file, or maybe you have forgotten to implement this function.

If you want better responses, post your code.

By the way, the signature for the constructor in question probably looks something like this:

Adjutancy::Adjutancy(set<Vehicle *,CompareCatId>*,vector<vector<Distance *> >*,map<string,Base *> *,map<int,City*> *

And there's about 48 things about your code that is absolutely horrible.

John Dibling
ok, that's a progress, thanks, i see now that my program don't know Adjutancy h and cpp file.
Roy Gavrielov
Solved. by reloading it. thanks
Roy Gavrielov
@Roy: What were you having problems with? The error message is very clear: "Unresolved external symbol Adjutancy::Adjutancy"... (all the rest is details).
abelenky
@abelenky i saw that, i thought my constructor was not good because of that error message.
Roy Gavrielov
For future reference: It did not say "There is a problem with your constructor." It said, "I cannot find your constructor." In general, remember that compiler/linker messages are usually VERY good, and the biggest problem is that many programmers do not READ the message, leading them to statements like, "there was some error, and I didn't know what to do."
abelenky
you're absolutly right, come on shoot me.
Roy Gavrielov
A: 

Typically linker errors indicate one (or more) of these:

  1. The function is declared (and used), but not defined. Define the function.
  2. You're missing a declspec. When building/consuming classes/functions for use in a DLL, you need to qualify the declarations with declspec(dllexport), and then qualify them with declspec(dllimport) when consuming the types (typically this is done using a macro that is defined differently during compilation versus consumption).
  3. You're missing a lib inclusion when linking. Add the necessary lib dependency to your link command.
Nathan Ernst