views:

160

answers:

4

When I build my project it compiles well, but when Linking it throws huge number of LNK errors! error LNK2001, error LNK2005, error LNK2019 were there in the error list

>Linking...
1>MultiCatAttributeInfo.obj : error LNK2019: unresolved external symbol "public: class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > __thiscall MultiCatItem::value(void)const " (?value@MultiCatItem@@QBE?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@XZ) referenced in function "public: virtual class boost::dynamic_bitset<unsigned long,class std::allocator<unsigned long> > __thiscall MultiCatAttributeInfo::encode(class Item *)" (?encode@MultiCatAttributeInfo@@UAE?AV?$dynamic_bitset@KV?$allocator@K@std@@@boost@@PAVItem@@@Z)

how do I overcome this problem? Im using visual studio 2008, my solution has several projects; all give Linking errors like above!!!

A: 

Well, it looks like you're not linking some files in. Have you checked to make sure you're actually compiling all of your source files?

It's hard to say anything specific without any code.

GMan
A: 

Error says that you are have not implemented or linked function MultiCatItem::value that referenced in function MultiCatAttributeInfo::encode. Check that you included appropriate cpp file with MultiCatItem implementation in the project.

Kirill V. Lyadvinsky
A: 

The linker is trying to find an implementation for the MultiCatItem::value function, which it will find in either an obj file (ie a compiled cpp file) or a compiled library (ie a .lib file, specified in the linker properties Input section).

The linker is understandably quite pedantic so if you're linking to a compiled lib make sure that the compiled library was compiled with the same settings and, for example, your compiled lib was not compiled with Unicode settings, which would mean that the signature for the method would change from using char to wchar_t.

If you are using compiled libs use the tool dumpbin to dump out all exported functions/classes etc. from the .lib, e.g.

dumpbin.exe /all somelibrary.lib > out.txt

and check that the signatures of the problem link reference is the same in the .lib as Visual Studio is looking for.

snowdude
+1  A: 

If you're using DLLs, it could be that you haven't properly exported your classes by setting __declspec(dllexport) (and __declspec(dllimport) when importing the header file in other projects). Then the linker is unable to see the functions/classes.

MP24