Visual Studio 2010 - LINK : fatal error LNK1181: cannot open input file " ■/.obj"

Viewed 25546

I have VS 2010 on Windows 7. I create a new project, chose c++ language, Win32 project, DLL, Export symbols, then finish. Now when I compile the project without any changes to what VS generates, I get...

LINK : fatal error LNK1181: cannot open input file " ■/.obj"

I also have VS 2008 install on the same machine. I follow the same steps and it compiles. What am I doing wrong?

Edit Okay, I've discovered that this error is due to an old version of the linker being used. I am not sure why. In VS2010, the project directories are set differently than in VS2008. Once I figure that out, maybe I can solve my own problem.

4 Answers

Me too came across the same problem while compiling a VC++ project in Visual Studio 2017. The compiler complained the following.

LINK : fatal error LNK1181: cannot open input file " ■/.obj"

Up on analyzing the issue, it is found that project "Configuration Properties - VC++ Directories - Executable Directories" as shown below contained a path to Microsoft Visual Basic folder C:\Program Files (x86)\Microsoft Visual Studio\VB98 which has its own link.exe.

Visual Studio Executable Directories dialog

The linker error occurred due to the fact that Visual Studio was invoking Visual Basic linker rather than Visual C++ linker!

This happened because path to Visual Basic linker is listed first in the above dialog and hence Visual Studio encountered Visual Basic linker.exe first while going through path to Executable Directories.

One of the solution is to update order of inclusion of path in Executable Directories by moving path to VB98 folder from first to last. It can be achieved by editing required property file(s) such as Microsoft.Cpp.Win32.user.props present in $(USERPROFILE)\appdata\local\microsoft\msbuild\v4.0 directory.

In my case (VS 2017), I had to delete the following entries in Linker -> Additional dependencies:

\
$(INHERIT)\

Possibly added by Qt pre-processor.

Related