I got a library here which uses the Intel Composer XE 2013 and I would like to compile it as a .lib as I am going to use it with another project (It is compiling as application/EXE by default). However, when I set the Configuration Type under Project Defaults under the Configuration Manager in Visual Studio 2012, I get » error LNK1181: cannot open input file» Odd part is that the file it looks for has no file ending. The project contains both C, C++ and ASM code. Does anyone got any experience with this kind of behavior?
asked Jul 10, 2013 at 22:17
2
Some common causes for error LNK1181 are:
- filename is referenced as an additional dependency on the linker
line, but the file does not exist. - A /LIBPATH statement that specifies the directory containing filename
is missing.
To resolve the above issues, ensure any files referenced on the linker line are present on the system.
Use the /LIBPATH option to override the environment library path. The linker will first search in the path specified by this option, and then search in the path specified in the LIB environment variable. You can specify only one directory for each /LIBPATH option you enter. If you want to specify more than one directory, you must specify multiple /LIBPATH options. The linker will then search the specified directories in order.
To set this linker option in the Visual Studio development environment
- Open the project’s Property Pages dialog box.
- Click the Linker folder.
- Click the General property page.
- Modify the Additional Library Directories property.
If that doesn’t help then you can look through these links :
- Getting fatal error LNK1181: cannot open input file
- You receive a «fatal error LNK1181» error message when you build a
Managed C++ application - Visual Studio: LINK : fatal error LNK1181: cannot open input
file
mirh
4767 silver badges14 bronze badges
answered Jul 11, 2013 at 1:23
![]()
0decimal00decimal0
3,8862 gold badges23 silver badges39 bronze badges
2
I solved the issue by renaming the .obj files without their file extension. For example, it was looking for file name «foo», I had «foo.obj» so I renamed «foo.obj» to «foo».
answered Jul 14, 2013 at 13:07
MartinMartin
2,4664 gold badges24 silver badges36 bronze badges
0
I got a library here which uses the Intel Composer XE 2013 and I would like to compile it as a .lib as I am going to use it with another project (It is compiling as application/EXE by default). However, when I set the Configuration Type under Project Defaults under the Configuration Manager in Visual Studio 2012, I get » error LNK1181: cannot open input file» Odd part is that the file it looks for has no file ending. The project contains both C, C++ and ASM code. Does anyone got any experience with this kind of behavior?
asked Jul 10, 2013 at 22:17
2
Some common causes for error LNK1181 are:
- filename is referenced as an additional dependency on the linker
line, but the file does not exist. - A /LIBPATH statement that specifies the directory containing filename
is missing.
To resolve the above issues, ensure any files referenced on the linker line are present on the system.
Use the /LIBPATH option to override the environment library path. The linker will first search in the path specified by this option, and then search in the path specified in the LIB environment variable. You can specify only one directory for each /LIBPATH option you enter. If you want to specify more than one directory, you must specify multiple /LIBPATH options. The linker will then search the specified directories in order.
To set this linker option in the Visual Studio development environment
- Open the project’s Property Pages dialog box.
- Click the Linker folder.
- Click the General property page.
- Modify the Additional Library Directories property.
If that doesn’t help then you can look through these links :
- Getting fatal error LNK1181: cannot open input file
- You receive a «fatal error LNK1181» error message when you build a
Managed C++ application - Visual Studio: LINK : fatal error LNK1181: cannot open input
file
mirh
4767 silver badges14 bronze badges
answered Jul 11, 2013 at 1:23
![]()
0decimal00decimal0
3,8862 gold badges23 silver badges39 bronze badges
2
I solved the issue by renaming the .obj files without their file extension. For example, it was looking for file name «foo», I had «foo.obj» so I renamed «foo.obj» to «foo».
answered Jul 14, 2013 at 13:07
MartinMartin
2,4664 gold badges24 silver badges36 bronze badges
0
I’ve been encountering a strange bug in Visual Studio 2010 for some time now.
I have a solution consisting of a project which compiles to a static library, and another project which is really simple but depends on this library.
Sometimes, in the last days extremely frequent, after Rebuilding the Solution or just compiling it with 1-3 changed source files, I get the following error:
2>LINK : fatal error LNK1181: cannot open input file 'thelibrary.lib'
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========
Where compiling thelibrary.lib was a success without any errors or warnings.
I have tried cleaning the solution, but that doesn’t always work.
- What is wrong here?
![]()
BartoszKP
34.2k14 gold badges104 silver badges129 bronze badges
asked Jun 23, 2011 at 8:33
2
In Linker, general, additional library directories, add the directory to the .dll or .libs you have included in Linker, Input.
It does not work if you put this in VC++ Directories, Library Directories.
answered Jun 25, 2012 at 2:19
![]()
I can see only 1 things happening here:
You did’t set properly dependences to thelibrary.lib in your project meaning that thelibrary.lib is built in the wrong order (Or in the same time if you have more then 1 CPU build configuration, which can also explain randomness of the error). ( You can change the project dependences in: Menu->Project->Project Dependencies )
answered Jun 23, 2011 at 8:51
SashaSasha
8365 silver badges9 bronze badges
4
Go to:
Project properties -> Linker -> General -> Link Library Dependencies set No.
user
86.7k18 gold badges198 silver badges190 bronze badges
answered May 29, 2012 at 11:50
EkaYudaEkaYuda
1271 silver badge4 bronze badges
1
I recently hit the same error. Some digging brought up this:
http://support.microsoft.com/kb/815645
Basically, if you have spaces in the path of the .lib, that’s bad. Don’t know if that’s what’s happening for you, but seems reasonably possible.
The fix is either 1) put the lib reference in «quotes», or 2) add the lib’s path to your Library Directories (Configuration Properties >> VC++ Directories).
answered Nov 11, 2011 at 13:05
ClippyClippy
3543 silver badges10 bronze badges
2
I had the same issue in both VS 2010 and VS 2012.
On my system the first static lib was built and then got immediately deleted when the main project started building.
The problem is the common intermediate folder for several projects. Just assign separate intermediate folder for each project.
Read more on this here
answered Sep 29, 2013 at 10:50
alexkralexkr
4,5641 gold badge23 silver badges21 bronze badges
1
I solved it with the following:
Go to View-> Property Pages -> Configuration Properties -> Linker -> Input
Under additional dependencies add the thelibrary.lib. Don’t use any quotations.
answered Feb 7, 2013 at 3:08
I had a similar problem in that I was getting LINK1181 errors on the .OBJ file that was part of the project itself (and there were only 2 .cxx files in the entire project).
Initially I had setup the project to generate an .EXE in Visual Studio, and then in the
Property Pages -> Configuration Properties -> General -> Project Defaults -> Configuration Type, I changed the .EXE to .DLL. Suspecting that somehow Visual Studio 2008 was getting confused, I recreated the entire solution from scratch using .DLL mode right from the start. Problem went away after that. I imagine if you manually picked your way through the .vcproj and other related files you could figure out how to fix things without starting from scratch (but my program consisted of two .cpp files so it was easier to start over).
Vikdor
23.8k10 gold badges61 silver badges83 bronze badges
answered Oct 7, 2012 at 4:43
user1726157user1726157
2512 silver badges4 bronze badges
I’m stumbling into the same issue. For me it seems to be caused by having 2 projects with the same name, one depending on the other.
For example, I have one project named Foo which produces Foo.lib. I then have another project that’s also named Foo which produces Foo.exe and links in Foo.lib.
I watched the file activity w/ Process Monitor. What seems to be happening is Foo(lib) is built first—which is proper because Foo(exe) is marked as depending on Foo(lib). This is all fine and builds successfully, and is placed in the output directory—$(OutDir)$(TargetName)$(TargetExt). Then Foo(exe) is triggered to rebuild. Well, a rebuild is a clean followed by a build. It seems like the ‘clean’ stage of Foo.exe is deleting Foo.lib from the output directory. This also explains why a subsequent ‘build’ works—that doesn’t delete output files.
A bug in VS I guess.
Unfortunately I don’t have a solution to the problem as it involves Rebuild. A workaround is to manually issue Clean, and then Build.
answered Apr 25, 2013 at 5:26
I don’t know why, but changing the Linker->Input->Additional Dependencies reference from «dxguid.lib» to «C:Program Files (x86)Microsoft DirectX SDK (June 2010)Libx86dxguid.lib» (in my case) was the only thing that worked.
answered Dec 3, 2013 at 7:56
VicVic
4586 silver badges14 bronze badges
Maybe you have a hardware problem.
I had the same problem on my old system (AMD 1800 MHz CPU ,1GB RAM ,Windows 7 Ultimate) ,until I changed the 2x 512 MB RAM to 2x 1GB RAM. Haven’t had any problems since. Also other (minor) problems disappeared. Guess those two 512 MB modules didn’t like each other that much ,because 2x 512 MB + 1GB or 1x 512 MB + 2x 1GB didn’t work properly either.
answered Jun 24, 2011 at 8:09
engf-010engf-010
3,9741 gold badge14 silver badges25 bronze badges
For me the problem was a wrong include directory. I have no idea why this caused the error with the seemingly missing lib as the include directory only contains the header files. And the library directory had the correct path set.
answered Oct 17, 2014 at 12:54
![]()
mgttlingermgttlinger
1,4152 gold badges21 silver badges35 bronze badges
You can also fix the spaces-in-path problem by specifying the library path in DOS «8.3» format.
To get the 8.3 form, do (at the command line):
DIR /AD /X
recursively through every level of the directories.
answered Jun 4, 2016 at 22:15
PierrePierre
3,9542 gold badges33 silver badges39 bronze badges
I had the same problem. Solved it by defining a macro OBJECTS that contains all the linker objects e.g.:
OBJECTS = target.exe kernel32.lib mylib.lib (etc)
And then specifying $(OBJECTS) on the linker’s command line.
I don’t use Visual Studio though, just nmake and a .MAK file
![]()
0xdb
3,4741 gold badge19 silver badges36 bronze badges
answered Nov 4, 2017 at 16:47
I had the same error when running lib.exe from cmd on Windows with a long argument list. apparently cmd.exe has max line length of about 8K characters, which resulted that the filenames at the end of this threshold got changed, thus resulting in bad filename error.
my solution was to trim the line. I removed all paths from filenames and added single path using /LIBPATH option. for example:
/LIBPATH:absolute_path /OUT:outfilename filename1.obj filename2.obj ... filenameN.obj
answered Nov 1, 2018 at 14:31
I found a different solution for this…
Actually, I missed comma separator between two library paths. After adding common it worked for me.
Go to: Project properties -> Linker -> General -> Link Library Dependencies
At this path make sure the path of the library is correct.
Previous Code (With Bug — because I forgot to separate two lib paths with comma):
<Link><AdditionalLibraryDirectories>....Buildlib$(Configuration)**....BuildRelease;**%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
Code after fix (Just separate libraries with comma):
<Link><AdditionalLibraryDirectories>....Buildlib$(Configuration)**;....BuildRelease;**%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
Hope this will help you.
![]()
answered May 8, 2019 at 11:32
In my case I had the library installed using NuGet package (cpprestsdk) AND I falsely added the lib to the Additional Dependancies in the Linker settings. It turns out, the package does it all for you.
The linker then tried to find the library in the library path and of course could not find it.
After removing the library from the Additional Dependencies everything compiled and linked fine.
answered May 10, 2019 at 11:35
Bojan HrnkasBojan Hrnkas
1,53816 silver badges22 bronze badges
Not quite the answer to OP’s question as I am using CMake with Visual Studio as a generator but I personally also just encountered the same issue (I am using Visual Studio toolchain, but not the IDE to build stuff).
My fix was target linking the directory of the directory of the libraries (I had a few) before target linking the library.
//Works
target_link_directories(MyExe PRIVATE /out/of/scope/path/to/lib)
foreach(X IN LISTS LIBSLISTNAMES)
target_link_libraries(MyExe ${X})
endforeach()
//Throws cannot open cannot open input file error
foreach(X IN LISTS LIBSLISTNAMES)
target_link_libraries(MyExe /out/of/scope/path/to/lib/${X})
endforeach()
Not sure what is happening under the hood, but maybe VS IDE has equivalent setting somewhere?
answered Jun 17, 2021 at 0:36
I’ve also experienced this problem. For me the dependencies were properly set, but one of the projects in my solution wasn’t selected for building in the configuration (VS 2022 pro).
I eventually figured out thanks to output in Build -> Clean Solution that mentioned one of the project in dependency chain being disabled. Interesingly enough, when trying to build the disabled project it wouldd not properly build its dependencies.
answered Feb 14, 2022 at 15:14
BarnabaBarnaba
6475 silver badges19 bronze badges
I created a bin directory at the project_dir level, then created a release/debug directory inside the bin folder, which solved the problem for me.
Matt
73.6k26 gold badges151 silver badges180 bronze badges
answered Aug 19, 2013 at 17:11

- Remove From My Forums
-
Question
-
I compiled my program after doing all those settings in «Project Setting Menu»
but i got an error :fatal error LNK1181: cannot open input file «,.obj»
I think there is some problem in the settings. I checked all the settings tht i know but still not able to remove this error.
If anyone know about the settings in VC++ then plz reply
any help will be of great use
Thanks in advance
Answers
-
belikekhushi wrote: I checked my linker settings.. Earlier i was using comma to seperate entries sso in was getting error with «,.obj» input file
Now, i replaced comma with semi-colon and now i am getting same error with «;.obj» file..
I think the libraries files have to be separated with a single space. If path contains a space, then use quotation marks.
Otherwise «;» and «,» are treated as file names with «.obj» default extension.
Hope it helps.
-
Check you linker settings. Did you placed a comma into one of those fields? Separate entries with a semicolon.
-
Sorry! I have no idea.
I even can not see that there is a part like this in the command line.
Try to create a new project from scratch.
All replies
-
Check you linker settings. Did you placed a comma into one of those fields? Separate entries with a semicolon.
-
I checked my linker settings.. Earlier i was using comma to seperate entries sso in was getting error with «,.obj» input file
Now, i replaced comma with semi-colon and now i am getting same error with «;.obj» file..
Plz help me out…
-
What did you entered in you linker settings.
-
I tried following two:
First time i tried this one :
«E:MSDev98MyProjectsDCMConverterpngDebugpng.lib» ; «E:MSDev98MyProjectsDCMConverterjpegDebugjpeg.lib» ; «E:MSDev98MyProjectsDCMConverterzlibDebugzlib.lib» ; «E:MSDev98MyProjectsDCMConvertertiffDebugtiff.lib» ; «E:MSDev98MyProjectsDCMConvertercximageDebugcximage.lib»
and second time i tried this one:
E:MSDev98MyProjectsDCMConverterpngDebugpng.lib ; E:MSDev98MyProjectsDCMConverterjpegDebugjpeg.lib ; E:MSDev98MyProjectsDCMConverterzlibDebugzlib.lib ; E:MSDev98MyProjectsDCMConvertertiffDebugtiff.lib ; E:MSDev98MyProjectsDCMConvertercximageDebugcximage.lib
In both cases i m getting the same error msg
Linking…
LINK : fatal error LNK1104: cannot open file «;.obj»
Error executing link.exe. -
Look into the build log, what is the command line for the build process.
-
I am sending you the command line of build log
I am new to VC++ so, Its difficult for me to find error in this log.
Build Log
--------------------Configuration: DCMConverter - Win32 Debug--------------------
Command Lines
Creating temporary file "C:DOCUME~1ADMINI~1LOCALS~1TempRSP10B.tmp" with contents [ E:MSDev98MyProjectsDCMConverterpngDebugpng.lib ; E:MSDev98MyProjectsDCMConverterjpegDebugjpeg.lib ; E:MSDev98MyProjectsDCMConverterzlibDebugzlib.lib ; E:MSDev98MyProjectsDCMConvertertiffDebugtiff.lib ; E:MSDev98MyProjectsDCMConvertercximageDebugcximage.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/DCMConverter.pdb" /debug /machine:I386 /nodefaultlib:"msvcprtd.lib" /nodefaultlib:"msvcrtd.lib" /nodefaultlib:"msvcrt.lib" /out:"Release/DCMConverter.exe" /pdbtype:sept /libpath:"D:cximage599c_fullCxImageCxImageDLLDebug" /libpath:"D:dcmtkdcmtk-3.5.3Debug" /libpath:"D:dcmtkconfiginclude" /libpath:"D:dcmtkdcmjpeginclude" /libpath:"D:dcmtkofstdinclude" /libpath:"D:dcmtkdcmdatainclude" /libpath:"D:dcmtkdcmimgleinclude" /libpath:"D:dcmtkdcmimageinclude" /libpath:"D:dcmtkdcmjpeglibijg8" /libpath:"D:dcmtkdcmjpeglibijg12" /libpath:"D:dcmtkdcmjpeglibijg16" /libpath:"D:dcmtkzlib-1.2.1" /libpath:"D:dcmtktiff-v3.6.1libtiff" /libpath:"D:dcmtklibpng-1.2.5" .DebugDCMConverter.obj .DebugDCMConverterDlg.obj .DebugStdAfx.obj .DebugxImageDCM.obj .DebugDCMConverter.res ] Creating command line "link.exe @C:DOCUME~1ADMINI~1LOCALS~1TempRSP10B.tmp"Output Window
Linking... LINK : fatal error LNK1104: cannot open file ";.obj" Error executing link.exe.Results
DCMConverter.exe - 1 error(s), 0 warning(s) -
Sorry! I have no idea.
I even can not see that there is a part like this in the command line.
Try to create a new project from scratch.
-
As Martin suggested, try creating project from scratch and see if the issue still reproduces.
Thanks, Ayman Shoukry VC++ Team -
hello
i’am a new member; please will tell me if you have already found a solution for this problem , because i have the same problem, please it’s very urgent for me :
the message is:
Linking…
LINK : fatal error LNK1181: cannot open input file ‘.DebugAssemblyInfo.obj’
thanks a lot
-
Please create a new thread.
Check your linker settings as I wrot ein this thread. Do you have an module named AssemblyInfo?
-
thanks for your answer
i have a module named AssemblyInfo, but my programm don’t generate AssemblyInfo.obj .
I don’t know what to change in linker settings will you help me please!
-
What kind of project is this? Managed C++/CLI?
What did you added to the project, what source files you have?
-
it’s C++, with a dll main. a added sources that i had in visual studio C++ , and now i want to have them in visual studio .Net
did you think that i should change liker settings ?
-
hello
i’am a new member; please will tell me if you have already found a solution for this problem , because i have the same problem, please it’s very urgent for me :
the message is:
Linking…
LINK : fatal error LNK1181: cannot open input file ‘.DebugAssemblyInfo.obj’
thanks a lot
-
Whats in your linker settings?
-
belikekhushi wrote: I checked my linker settings.. Earlier i was using comma to seperate entries sso in was getting error with «,.obj» input file
Now, i replaced comma with semi-colon and now i am getting same error with «;.obj» file..
I think the libraries files have to be separated with a single space. If path contains a space, then use quotation marks.
Otherwise «;» and «,» are treated as file names with «.obj» default extension.
Hope it helps.
-
hi,
sorry, if i m late in replying that query.
i am not very good at vc++ but yes i have two options to go for ur problem:
first, go to the linker settings give their full path (like D;test……) and not the relative one…
then build ur code again and then execute…
if this helps thn its ok otherwise delete this «.DebugAssemblyInfo.obj» entry from the linker settings and then build the whole project again…
hope one of these may help you…
-
I confirm, after a lot of try i find that the libraries files have to be separated with a single space.
-
Hello ,
I have the same problem, using Visual studio 2008, but i really don’t understand what are the indications! How can I change the linker settings?
When i look into the Linker…it has many submodules, like Generate, Input….and in the end: Command line, which has the following:
/OUT:»C:Documents and SettingssimonaMy DocumentsVisual Studio 2008Projects1Debug1.exe» /INCREMENTAL /NOLOGO /MANIFEST /MANIFESTFILE:»Debug1.exe.intermediate.manifest» /MANIFESTUAC:»level=’asInvoker’ uiAccess=’false'» /DEBUG /PDB:»C:Documents and SettingssimonaMy DocumentsVisual Studio 2008Projects1Debug1.pdb» /SUBSYSTEM:WINDOWS /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:PROMPT kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
I just wrote a simple Hello world program. I get this error all the time(also in Visual Studio 2005 and Visual Studio 2008):
Error 1 fatal error LNK1104: cannot open file ‘.Debugmain.obj’ 2 2
Where main is the simple hello world program, whether it’s C++ or C. I tried reinstalling many times. No luck.
Help , please??
Thanks
-
Try resetting all your settings from whithin IDE.
to do so under tool menu click import and export settings then click reset all.give it a try.
regards
Adi
A K
-
I have encounterd the same problem,but I can’t find linker in project settings,instead I find library,how can I solve the problem?
-
I ran into a similar problem on Visual Studio 2017.
The error was indeed cryptic. I got it to work by realizing that I forgot to include some external cpp files that needed to be compiled and built with my project.
For those of you who run into the problem and found this thread, check and make sure that you haven’t forgot to include:
- External .cpp files
- That in your Linker –> Input –> Additional Dependencies settings, there’s no blank library like «.» or «$(INHERIT)»