Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual C++ - cant see which external missing

I try to build my multiproject application in Visuas C++ 10 in release mode.
I get the next link error:
2> All outputs are up-to-date. 2>PidAppLib.lib(ThreadWin32.obj) : error LNK2011: precompiled object not linked in; image may not run
2>C:\infinite_memories_svn\projects\sw\NewPidTools\PidWriter\Release\PidLabler.exe : fatal error LNK1120: 1 unresolved externals
2>
2>Build FAILED.

How can I know which object unresolved?
ThreadWin32.obj is external lib which was downloaded from internet.

like image 468
Costa Mirkin Avatar asked Apr 17 '12 09:04

Costa Mirkin


2 Answers

Ok.
I've solved the problem.
I have 2 libraries, let say a.lib and b.lib, and project, c. a.lib uses b.lib so in librarian dependencies of a.lib I added b.lib, c uses a.lib so I added it to dependencies.
It works in debug but in release I should also add b.lib to dependencies of c. Strange but it solved the problem

like image 82
Costa Mirkin Avatar answered Nov 13 '22 11:11

Costa Mirkin


I had this error in a large project I was refactoring. During the refactoring process I would occasionally compile individual source files to check changes I'd made without having to build the entire project. Depending on your project configuration this can result in .obj files being output in a different directory to where they would normally be output when you build the project. In my case the .obj files for source files compiled manually were output in the source code directory instead of the intermediate build directory.

A side-effect of this appeared to be that when building the whole project, source files that had been manually compiled might not be recompiled even if other changes elsewhere meant they should be (like a change that required recompiling the precompiled header file).

The solution for me was to manually delete all .obj files generated by manually compiling individual source files. Depending on project configuration executing Clean on the project might also work.

like image 37
Neutrino Avatar answered Nov 13 '22 12:11

Neutrino