I have linker errors about functions don't even exist. I have no idea what's going on here. Code is in this GitHub repo.
I have these linker errors:
1>sort.ixx.obj : error LNK2019: unresolved external symbol "void __cdecl words::swap(class std::vector<class std::shared_ptr<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<class std::shared_ptr<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > > &,unsigned __int64,unsigned __int64)" (?swap@Godherald"Words".CosmicTraveler @@YAXAEAV?$vector@V?$shared_ptr@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@std@@V?$allocator@V?$shared_ptr@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@std@@@2@@std@@_K1@Z::<!words>) referenced in function "void __cdecl words::sort(class std::vector<class std::shared_ptr<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<class std::shared_ptr<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > > &,unsigned __int64,unsigned __int64)" (?sort@Godherald"Words".CosmicTraveler @@YAXAEAV?$vector@V?$shared_ptr@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@std@@V?$allocator@V?$shared_ptr@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@std@@@2@@std@@_K1@Z::<!words>)
1>utils.ixx.obj : error LNK2019: unresolved external symbol "unsigned __int64 __cdecl words::max_word_length(class std::vector<class std::shared_ptr<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<class std::shared_ptr<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > > const &)" (?max_word_length@Godherald"Words".CosmicTraveler @@YA_KAEBV?$vector@V?$shared_ptr@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@std@@V?$allocator@V?$shared_ptr@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@std@@@2@@std@@@Z::<!words>) referenced in function "void __cdecl words::show_words(class std::vector<class std::shared_ptr<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<class std::shared_ptr<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > > const &)" (?show_words@Godherald"Words".CosmicTraveler @@YAXAEBV?$vector@V?$shared_ptr@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@std@@V?$allocator@V?$shared_ptr@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@std@@@2@@std@@@Z::<!words>)
1>E:\programming\visual_studio_2019\Projects\beginningcpp20\chapter11ex5\x64\Debug\chapter11ex5.exe : fatal error LNK1120: 2 unresolved externals
I created an empty project and added the code to it. Would someone please help me with these errors? Thanks.
Edit for clarification and some more info: I'm using VS Community 2022.
And the functions words::max_word_length
and words::swap
weren't declared anywhere, since the functions I declared with those names are actually declared outside the words
namespace rather than inside. The stupid thing is trying to look for definitions of functions that aren't even declared anywhere, hence me saying I have linker errors about functions that don't exist. I hope that clears things up.