This particular issue is caused by specifying a dependency to a lib file that had spaces in its path. The path needs to be surrounded by quotes for the project to compile correctly.
On the Configuration Properties -> Linker -> Input tab of the project’s properties, there is an Additional Dependencies property. This issue was fixed by changing this property from:
C:\Program Files\sofware sdk\lib\library.lib
to:
" C:\Program Files\sofware sdk\lib\library.lib"
but after compiling, it says:
Error 1 fatal error LNK1104: cannot open file 'sdk\lib\library.lib'
How can I resolve this?
Try adding the path to your linker path and just the 'library.lib' name to your libs.
Related
I have been trying to figure out this error for a while now but I cannot find anything, whenever I try to build my program I get the error:
C1083: Cannot open include file: 'corecrt.h' No such file or directory.
edit: I added $(UniversalCRT_IncludePath) into additional include directories but I still get the error.
Attempting to add into additional include directories
Code and Error Here
You should check Additional Include Directories parameter for your C++ project.
To do that, go Project -> Properties -> C/C++ and add $(UniversalCRT_IncludePath) to Additional Include Directories parameter.
More information about Universal CRT can be found here.
I downloaded jpeglib-9a. In Visual studio (2012) command prompt I typed this:
nmake /f makefile.vc setup-v10
It created several files and one of them was named "jpeg.sln" which I opened in visual studio (updated to 2012 version) and built. After that, I made new project, included this folder "D:\Data\jpeg-9a" and added this folder "D:\Data\jpeg-9a\Release" to linker.
And when I tried to compile my project, this error appeared:
1>LINK : fatal error LNK1181: cannot open input file 'D:\Data\jpeg-9a\Release.obj'
I was looking for that file but couldn't find it anywhere. I also tried compile that library again but "Release.obj" is still missing.
This is the tutorial which I was following
http://www.dahlsys.com/misc/compiling_ijg_libjpeg/index.html
So is there any way how to create that file ?
Thank you.
(if you need additional information, ask me)
SOLVED: ... I cant read properly ...
Thank you bogdan
You don't need to create that file.
The linker is interpreting the D:\Data\jpeg-9a\Release directory name as an input .obj file name. Most likely, this is happening because you added the directory name in the wrong place in the linker configuration property pages. My guess is that you added it under Linker -> Input -> Additional Dependencies; that's not the right place for a directory - that property is supposed to contain a list of .obj and .lib files to be given as input to the linker.
You need to add the directory under Linker -> General -> Additional Library Directories.
I had to use a preprocessor, so I changed:
Configuration Properties -> C++ -> Preprocessor -> Preprocess to a
File -> Yes
And got the error:
Error 1 error LNK1104: cannot open file 'Debug\asnreal.obj'
The solution to this problem:
I had to add quotes around the path to my .lib file in
Project->Properties->Configuration
Properties->Linker->Input->Additional Dependencies .
I do not understand what kind of file .lib? Where is it? In my project, it is not. What do I need to specify in Additional Dependencies? I tried to add the path to debug my project in quotation marks, but nothing happens.
The compiler outputs either the .obj file or the preprocessed file. When you enable the preprocessor output you effectively disable the output of the .obj file.
The VS doesn't take this in account and starts the linker anyway. Since you didn't output an .obj file the linker can't find it.
You can get much more in trouble when you have an old .obj file in place and changes in the source code generates new preprocessed output but don't get into the linked executable.
I am trying to add ANN(open source k-d tree for fast nearest neighbor searching) to my VC++ project. I followed the manual and completed every step:
include the .h files
copy the .lib file, add its location to the linker additional directory
copy the .dll file, set location to environmental variable PATH, and import it in my project
I still get 24 "unresolved external..." errors. The library seems to be widely used and not supposed to be wrong, wondering what else do I need to do to use it?
Thanks guys!
The "unresolved external" error comes because the linker is not finding the "lib" files. The DLL files are only found during run time, not link time.
Do you set the names of the lib files in the project's Properties?
Configuration Properties -> Linker -> Input -> Additional Dependencies
Enter the filenames of the all the lib files, separated by spaces. If they are in your Project folder, use something like
$(ProjectDir)Foobar.lib
have you set path of lib correctly?
you can use lib file along with its path in
on Configuration Properties -> Linker -> Input -> Additional Dependencies
or
just give lib file name in
Configuration Properties -> Linker -> Input -> Additional Dependencies
and lib path in
Configuration Properties -> Linker -> General -> Additional library directories
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?
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
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".