Linker Tools Error LNK2011

precompiled object not linked in; image may not run

If you use precompiled headers, LINK now requires that all of the object files created with precompiled headers must be linked in. If you have a source file that you use to generate a precompiled header for use with other source files, you now must include the object file created along with the precompiled header.

For example, if you compile a file called STUB.CPP to create a precompiled header for use with other source files, you must link with STUB.OBJ or you will get this error. In the following command lines, line one is used to create a precompiled header, COMMON.PCH, that is used with PROG1.CPP and PROG2.CPP in lines two and three. The file STUB.CPP contains only #include lines (the same #include lines as in PROG1.CPP and PROG2.CPP) and is used only to generate precompiled headers. In the last line, STUB.OBJ must be linked in to avoid LNK2011.

cl /c /Yccommon.pch stub.cpp
cl /c /Yucommon.pch prog1.cpp
cl /c /Yucommon.pch prog2.cpp
link /Feprog.exe stub.obj prog1.obj prog2.obj