Error LNK1104 cannot open file ';.obj'
Asked Answered
A

4

12

Error LNK1104 cannot open file ';.obj' project1 D:\project1\source\project1\project1\LINK 1

I'm using visual studio 2015 and openframeworks, I'm fairly new to the c++ language.

I couldn't find a line of code which refers to this file.

Has anyone had a similar error or does know any tips to find the cause of this error?

Archle answered 25/12, 2015 at 12:15 Comment(1)
I couldn't find a line of code which refers to this file. This is not a code problem. I say it looks like your linker settings are messed up somehow.Attrahent
N
7

The build-process has two main step:

  • compile
  • link

In the compiling stage the obj files are built from the source file. In the linking step these obj files are "concatenated" resolving unresolved references and builds the final output (static/dynamic library or an executable).

Your error is a linker error which says that one of the compiled file cannot be found. This can happen when:

  • the compilation is failed (check the previous errors if any)
  • the compilation is skipped for the specified source file for some reason (this can happen when the whole project is excluded from the build process or you specified that it should save the preprocessed file only).

Do you have any other error messages or warnings? Please check if you're actually building the specified project (and the actual source file as well). As a first step, you can check it in the Build -> Configuration Manager. Look at the checkbox in the "Build" column.

Nichellenichol answered 25/12, 2015 at 13:3 Comment(1)
yes this was indeed the problem thnx for solving itArchle
R
4

How are you setting your input paths for the Linker? For C/C++, I have found for Visual Studio the location listed below is NOT the correct way to reference library files during the compiler-linking stage (at least in Community Version 2017). I had a project folder called 'lib' which contained all my .lib files. Originally I had specified a value like (which was wrong):

Linker --> General --> Additional Library Directories: $(ProjectDir)lib;%(AdditionalDependencies)

I was getting error messages like:

error LNK1104: cannot open file 'lib.obj'

I figured out this was the correct way to specify the library directories:

VC++ Directories --> Library Directories

In my case, my value was:

VC++ Directories --> Library Directories: $(ProjectDir)lib;$(LibraryPath)
Reflect answered 20/2, 2019 at 18:51 Comment(0)
C
4

I had built a static library, say TempLibrary.lib. I was linking this library with my application and got the above error in VS2015. The problem was, that I was mentioning only the name of the library and I missed the extension. i.e, I had added only the name "TempLibrary" in the

Linker->Input->Additional Dependencies.

After I had added the extension (.lib) to the name, the linker issue got resolved. i.e, TempLibrary.lib

Christman answered 15/7, 2020 at 7:35 Comment(1)
Yep -- did the exact same thingGave
L
0

In my case I was compiling the excellent MD5 command-line utility from R. Rivest, in VS2022.

The error was saying that it could not open setargv.obj

It turned out, I just had to delete it from the source list, as I was trying to compile the project in C:\Programs. Once I took the project out into a non-windows folder like C:\temp, it worked.

It was an access issue.

Lagging answered 20/12, 2023 at 3:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.