Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Linker Error

Linker Error

Linker Error

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?

Generating Code...
Compiling resources...
Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
Copyright (C) Microsoft Corporation.  All rights reserved.
LINK : fatal error LNK1104: cannot open file 'd:\vtk50\lib.obj'

RE: Linker Error

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.

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

RE: Linker Error

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


RE: Linker Error

Do you have any .cpp files or projects called "lib"?

RE: Linker Error

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?


RE: Linker Error

Try this for the linker dependency:


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

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

RE: Linker Error


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?


RE: Linker Error

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

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

RE: Linker Error

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 :)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close