This is an issue for someone much wiser than I - perhaps a MVP will help?
I color coded the following for readability.
Running XP Pro and VC++.Net Express 2008 and vtk visualization software
In the Linker | Input ....... No additional dependencies are set
An Expected Result Follows:
------ Build started: Project: Cone041906, Configuration: Debug Win32 ------
Linking...
Cone.obj : error LNK2019: unresolved external symbol "public: void
__thiscall vtkCamera::Zoom(double)" (?Zoom@vtkCamera@@QAEXN@Z) referenced in
function _main
//////// First and last of the 16 are shown here ///////////////
Cone.obj : error LNK2019: unresolved external symbol "public: static class
vtkCylinderSource * __cdecl vtkCylinderSource::New(void)"
(?New@vtkCylinderSource@@SAPAV1@XZ) referenced in function _main
Debug/Cone041906.exe : fatal error LNK1120: 16 unresolved externals
Build log was saved at "file://h:\vtk\Bobs Working
Examples\Cone041906\Debug\BuildLog.htm"
Cone041906 - 17 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Now I set a dependency d:\vtk50\Lib thinking that this should resolve the
missing 16 unresolved externals
Result Follows:
------ Rebuild All started: Project: Cone041906, Configuration: Debug
Win32 ------
Deleting intermediate and output files for project 'Cone041906',
configuration 'Debug|Win32'
Compiling...
Cone.cpp
Compiling manifest to resources...
Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
Copyright (C) Microsoft Corporation. All rights reserved.
Linking...
LINK : fatal error LNK1104: cannot open file 'd:\vtk50\Lib.obj'
Build log was saved at "file://h:\vtk\Bobs Working
Examples\Cone041906\Debug\BuildLog.htm"
Cone041906 - 1 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
It seems that the Linker now finds the unresolved externals
and generates the need for a Lib.obj file that doesn't exist!
Why does the Linker find the .Lib files and then generate the need for a
Lib.obj file that it didn't need before?
Tom Walker - 15 Jan 2008 05:27 GMT
> This is an issue for someone much wiser than I - perhaps a MVP will help?
>
[quoted text clipped - 7 lines]
> Why does the Linker find the .Lib files and then generate the need for a
> Lib.obj file that it didn't need before?
You added a linker dependency on d:\vtk50\Lib. A dependency should be either
a .lib or .obj file. Since you didn't provide a file type, the linker
assumed you meant .obj. You probably meant to add a dependency such as
d:\vtk50\Lib\MyLib.lib.
The 16 unresolved externals errors did not go away, its just that the linker
was not able to get to the point of trying to resolve externals since you
provided a bad dependency.
Bob Palank - 15 Jan 2008 14:44 GMT
Thanks for the clear response.
So, if I have 20 .lib files in one folder, I need to reference each .lib
file individually ?
Is there a simpler way ?
TIA
Bob
> This is an issue for someone much wiser than I - perhaps a MVP will help?
>
[quoted text clipped - 64 lines]
> Why does the Linker find the .Lib files and then generate the need for a
> Lib.obj file that it didn't need before?
Tom Walker - 15 Jan 2008 19:07 GMT
> Thanks for the clear response.
> So, if I have 20 .lib files in one folder, I need to reference each .lib
> file individually ?
Yes.
> Is there a simpler way ?
Not really.
You can add the folder to the linker's "Additional Libraries Directory"
setting, then you wouldn't have to specify the full path for each library.
But you still must explicitly specify each library.
Another way to specify the libraries is to put statements like these into
one of your source files:
#pragma comment(lib, "MyLib1.lib")
#pragma comment(lib, "MyLib2.lib")