How to fix a linking bug?
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::alloca开发者_JAVA百科tor<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
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.
Typically linker errors indicate one (or more) of these:
- The function is declared (and used), but not defined. Define the function.
- 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).
- You're missing a lib inclusion when linking. Add the necessary lib dependency to your link command.
精彩评论