Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linker Error

Status
Not open for further replies.

srfpala

Technical User
Dec 18, 2007
14
US
It seems the linker can't find a lib.obj file.
There isn't one! (see the build result below)
There is a vtkTest01.obj file which is what I expect to see. What would cause the linker to request a lib.obj file?



vtkTest01.cpp
AssemblyInfo.cpp
Generating Code...
Compiling 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'
 


Try Rebuild All from the Build menu.

I that doesn't work, delete the .ncb and all the files in the debug folder. Then rebuild the project.



HyperEngineer
If it ain't broke, it probably needs improvement.
 
Tried what you said
Rebuild Solution in VC++ Express 2008 ? ?
Same result -
LINK : fatal error LNK1104: cannot open file 'd:\vtk50\lib.obj'
1. What would cause the Linker to look for a file called lib.obj

2. Could it be that one or more of the .Lib files would generate this error
In the Lib folder I have Kernel32.Lib and vtkCommon.lib

TIA
Bob
 
Do you have any .cpp files or projects called "lib"?
 
No, I do not have any .cpp or projects called Lib.
If I remember correctly, the Linker needs one or more .obj files as input and access to *.lib files.
I do have a vtkTest01.cpp and a vtkTest01.obj Using these resources, it should build a vtkTest01.exe

As soon as I enter the additional Linker dependency d:\vtk50\lib the linker generates the error. When I remove it the code Compiles, Links and Runs!
Any thoughts as to what would cause the Linker to be looking for a lib.obj file?

Bob
 


Try this for the linker dependency:

d:\vtk50\lib\

It may think that it's not looking for a directory but a file called lib without the trailing "\".


HyperEngineer
If it ain't broke, it probably needs improvement.
 
Bob,

Is that file you want to link in really called d:\vtk50\lib (without extension?) Maybe the linker adds the .obj extension by itself for every input file without extension. In that case replacing in the dependancy ...\lib with ...\lib. (with an extra period) may solve the problem. Otherwise copy or rename the lib file to lib.obj.

Excuse me for asking, but if the code compiles, links and runs without the dependancy, why do you want to add it?

Marcel
 
Good idea! It changed the error file from Lib.obj to .obj
as shown below.

Linking...
LINK : fatal error LNK1104: cannot open file 'd:\vtk50\lib\.obj'
Build log was saved at "file://d:\vtk50\Examples\vtkTest01\vtkTest01\Debug\BuildLog.htm"
vtkTest01 - 1 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped
==============Next Test Follows ==========================
Now I changed it to d:\vtk50\ and get the following
LINK : fatal error LNK1104: cannot open file 'd:\vtk50\.obj'
Any clues are appreciated
 
OK...I just read over this quickly, and I might have missed something...buuuuttt....

When you add a linker dependency, it's because you have a .lib file thats needed for your application to understand what's going on. You don't add the directory name, you add the actual name of the file. So, if you need to add the Kernel32.Lib and vtkCommon.lib files, you would put each of them (seperated by a space) in the text box. If they're not in your search path, you'll need to put their path in too.

I've only had one cup of coffee so far today, so I may have missed something :) So if that doesn't work, let me know and I'll drink some more :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top