views:

230

answers:

1

I've just migrated a solution containing c++ and c# projects from VS2008 to VS2010 and got a strange problem.

When I select "rebuild all", everything compiles and links as I would expect it to do.

Then I change some c++ source file (just add a space), build the project, I get several thousands of linking errors like these:

GDlgPackerListe.obj : error LNK2028: Nicht aufgelöstes Token (0A0000C7) ""public: bool __thiscall LList::Add(class LBString const &)" (?Add@LList@@$$FQAE_NABVLBString@@@Z)", auf das in Funktion ""public: virtual void __thiscall LRcPackerListe::HookRunReport(class LFortschritt &)" (?HookRunReport@LRcPackerListe@@$$FUAEXAAVLFortschritt@@@Z)" verwiesen wird.
Db_Lieferschein2.obj : error LNK2020: Nicht aufgelöstes Token (0A0000E6) "public: bool __thiscall LList::Add(class LBString const &)" (?Add@LList@@$$FQAE_NABVLBString@@@Z).
bmed.obj : error LNK2028: Nicht aufgelöstes Token (0A00014D) ""public: bool __thiscall LList::Add(class LBString const &)" (?Add@LList@@$$FQAE_NABVLBString@@@Z)", auf das in Funktion ""public: virtual long __thiscall MENUKB::Methode(long,long)" (?Methode@MENUKB@@$$FUAEJJJ@Z)" verwiesen wird.
GDlgPackerListe.obj : error LNK2028: Nicht aufgelöstes Token (0A0000C9) ""public: void __thiscall LList::Sort(void)" (?Sort@LList@@$$FQAEXXZ)", auf das in Funktion ""public: virtual void __thiscall LRcPackerListe::HookRunReport(class LFortschritt &)" (?HookRunReport@LRcPackerListe@@$$FUAEXAAVLFortschritt@@@Z)" verwiesen wird.
Dlg_Gutschrift.obj : error LNK2020: Nicht aufgelöstes Token (0A000128) "public: virtual __thiscall LBaseType::~LBaseType(void)" (??1LBaseType@@$$FUAE@XZ).
Module_Damals.lib(svSuchAltLink.obj) : error LNK2001: Nicht aufgelöstes externes Symbol ""public: __thiscall SView::SView(void)" (??0SView@@QAE@XZ)".
Module_Damals.lib(svShowEMF.obj) : error LNK2001: Nicht aufgelöstes externes Symbol ""public: virtual void __thiscall SView::HookValueChanged(unsigned __int64)" (?HookValueChanged@SView@@UAEX_K@Z)".

When I hit "rebuild all" it recompiles and links without any errors or even warnings and produces a working exe.

I'm using Visual Studio 2010 final (german edition).

Whats going on here? Or, more important: how do I get the linker to work correctly??

A: 

Hi, I too am having this problem - did you ever get a solution that doesn't involve a Rebuild All?

Nick
Nope. Sad, isn't it :(
Sam
Well, after some head scratching, we seem to have found the answer. The problems, in our case at least, were two-fold: 1) We had set up project dependencies, but weren't using the newer 'project to project' references as a means of linking projects in to the target. Seems the old dependencies dialog isn't the place to go any more.2) We had some dubious code that had crept in where a virtual function was being defined but not implemented in a derived class - the base class had a default implementation. Why this isn't an error in rebuild all I don't know.
Nick
The following explains things better than I did :) http://blogs.msdn.com/b/vcblog/archive/2010/03/02/visual-studio-2010-c-project-upgrade-guide.aspx
Nick