fatal error lnk1104: can't open LNKn.tmp - visual-studio-2010

When I'm trying to build my MSVC2010 project with Bamboo's Visual-Studio task, I get the following error:
LINK : fatal error LNK1181: File "C:\Windows\system32\config\systemprofile\AppData\Local\Temp\lnk7A64.tmp" could not be opened.
msdn hast this to say:
If the given file is named LNKn, which is a filename generated by the linker for a temporary file, the directory specified in the TMP environment variable may not exist, or more than one directory is specified for the TMP environment variable. (Only one directory path should be specified for the TMP environment variable.)
So I checked my TMP variable and it has only one directory, which does exist.
Actually there is even a file generated, just not the right one.
So for example, I start the build, lnk7A64.tmp is created, but the linker looks for lnk7A64.tmp
I only get this error with Bamboo. It works fine with Visual Studio.
Any ideas as to why that happens and how to resolve it?
UPDATE:
I'm beginning to think this may be, because Bamboo can't find the executables needed for creating the right files (ressource compiler maybe). I've described this here before. I thought I could work around that problem, but it seems like it's causing this error too.

I had the same issue (which brought me to your question!). I figured out that by default, the bamboo agent service runs as "SYSTEM" and this did not jive with my build. Follow this guide from Atlassian to change the user that your bamboo agent runs as. I did this and it works now.
https://confluence.atlassian.com/display/BAMBOO/Running+Bamboo+service+on+Windows+as+the+local+user

I was running into a very similar issue:
C:\WINDOWS\system32\config\systemprofile\AppData\Local\Temp\lnk{A20CED18-5FC6-4AB0-84C2-B922E8CD543B}.tmp(1): error RC2135: file not found: C:\WINDOWS\system32\config\systemprofile\AppData\Local\Temp\lnk{E2128AA4-9E0E-48D0-814E-22F9FDD938F9}.tmp [C:\bamboo_home\xml-data\build-dir\Sources\VS2017\Core\Core.vcxproj]
Turns out the build server was using the x86 version of MSBuild at
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe
Instead of the x64 version at
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\amd64\MSBuild.exe
Ugh!

Related

Linker Error When Changing Visual Studio Output to System32

For a research, I'm developing a Proxy DLL for nvcuda.dll (NVIDIA CUDA runtime) which resides in System32. To ease up debugging I change linker output to System32, however, I receive
LINK : fatal error LNK1104: cannot open file 'C:\Windows\System32\nvcuda.dll'
Here are the solutions I have tried:
Disabled the UAC.
Took ownership of System32 folder.
Ran the program as admin.
There are no white-spaces in the path to the file and no other program uses the DLL (it can be removed and renamed manually). The linker works fine for any other location, am I missing something?
EDIT:
An interesting observation is that I am able to build the same solution using msbuild as follows:
msbuild nvcuda.sln /p:Configuration=Debug /p:Platform=x64

LNK1181: cannot open input file

I've successfully generated a 64-bit library called "myLibrary.lib" in project A using Visual Studio 2010.
Now I've another project B that uses "myLibrary.lib". I include the header files required to use "myLibrary.lib" in project B. Added the .lib into my project and added an entry for it in Linker>Input>Additional Dependencies.
When I try to build, I get an error "LINK : fatal error LNK1181: cannot open input file myLibrary.lib".
Things I've tried:
Tried to the path of my .lib file in Linker>General>Additional
Library Directories
If I do this, then I get unreferenced function errors for the ones I'm using from .lib
Tried giving my .lib name in quotes along with full path in
Linker>Input>Additional Dependencies
If I do this, then I get unreferenced function errors for the ones I'm using from .lib
Made sure there are no spaces in my lib name
Checked file permissions
Tried building on Visual Studio 2017 and still get same error
Is there anything else that I can try to workaround this error?
Based on the things you have tried, it seems you are going in the right direction. Few months ago, I have faced this problem in my VS 2010. I am getting an error like this
Error 1940 error LNK1181: cannot open input file 'element.lib'
I could not understand, whats going on, The file that the program is search for element.lib is there in that folder, but I do not understand, why it is showing error, then I tried few more things, as listed below
Either disable incremental linking, by going to
-> Project Properties
-> Configuration Properties
-> Linker (General)
-> Enable Incremental Linking -> "No (/INCREMENTAL:NO)"
cvtres.exe, file error in C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cvtres.exe and one at C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\cvtres.exe, Make sure you are using the latest version in both of these locations.
This one is tricky, another possible cause for LNK1181 is that a long file name with embedded spaces was not enclosed in quotation marks. In that case, the linker will only recognize a file name up to the first space, and then assume a file extension of .obj. Make sure the file name length including the file path is less than the characters specified for windows OS, i.e. 128characters including spaces...

Libwbxml compiling on Win32 environment

I've downloaded libwbxml source package from http://sourceforge.net/projects/libwbxml/files/libwbxml/0.11.0/ and followed instructions in the INSTALL file, trying to compile it for Windows environment. However, everytime I build the solution (I'm using VS 2005), I get several error messages like this:
fatal error C1083: Cannot open include file: 'wbxml_config.h': No such file or directory
I've searched throughout the web and could not find a definitive solution for it.
Based on my experience, building on Windows with Visual studio 98 will cause no error.
You may try to build another variant, wbxml2-0.9.2.tar, from sourceforce.net, it only causes error at test phase but the library and 2 tools can be built fine.

Visual Studio 2010 can't see /bin library of OpenCV

I'm trying to use OpenCv 2.2 in Visual Studio 2010.
I've configured everything by instruction:
http://opencv.willowgarage.com/wiki/VisualC%2B%2B
and by instruction from the book:
So I've added all /lib and /include paths.
When I build project, it compiles and before starting app, VS displays an error message that opencv_core220d.dll is missing.
This file is in C:/OpenCV2.2/bin as all .dll files. If I add this file to my working directory - it will be fine. Then VS displays error about every .dll file that I added in Linker-Input configuration ( but with .lib extension ).
So, if I add all .dlls file that I've added as .lib in Linker configuration - to my working directory, project will start.
But why? Why VC doesn't see OpenCV2.2/bin folder? Where is this pointed?
Because it doesn't know to look there by default. However, it does know to check the current directory for the DLLs.
You can tell it where to look by adding C:/OpenCV2.2/bin to your Path variable, or if you would rather not muck up your global Path you can set the Environment variable local to the C++ project.
I think that is the syntax for appending to the Path in VS2010, but I'm not sure, so Google it if that doesn't work :)

Visual Studio 2010: Windows Installer using msiexec.exe returns MSI Error 2727

I've got a Visual Studio Setup Project that uses the msiexec.exe file to create an Uninstall item as outlined in >> THIS << article on SO.
The Installer does not run.
When I launch the installer by double-clicking the setup.exe file, the "Please wait while setup launches" screen barely blips on the screen before I am confronted with my error.
The Text is (for search functions):
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2727.
I have found a set of MSI Error Codes, and Error Code 2727 translates to
The directory entry '[2]' does not exist in the Directory table.
Could someone guide me towards fixing this? What should I do?
[UPDATE]
At the suggestion of Cosmin Pirvu, I have created an error log for my installer. After looking it over, it appears my installation error could be the result of having a link to the Not Installed file msiexec.exe that I use in conjunction with my Project's [ProductCode] to create an Uninstall link.
The log file shown below appears to indicate that my installation fails when the installer attempts to create a temporary file for msiexec.exe, then it has another failure when it tries to display the Error Icon.
The file >> install.log on Google Sites << is my Error Log file's output (Hint: just do a search for Return value 3 to get to the errors).
[UPDATE 2]
I have an Uninstall link in the setup project that links back to the batch file uninstall.bat in my main project:
#echo off
%windir%\system32\msiexec.exe /x %1
The Arguments to the Uninstall link is only [ProductCode], since the /x switch is hard coded into the batch file.
[Solution]:
The Visual Studio Installer was not creating a folder that had some required DLLs in it.
The first step should be creating an installation log to see what triggers the error.
From the log you posted, it seems like your MSI tries to use a directory which is not in Directory table. Are you using any merge modules or special custom actions? If so, try to determine if they try to use a directory from your package.
You mentioned something about an uninstall shortcut. Can you give us more details?
Old question, I know - just wanted to add in some information that helped me with the Windows Installer project in Visual Studio 2015, in case anyone comes across this topic.
I got the same error message, 2727. My issue was that I was including my source code into an "src" folder in the installation directory. When looking at the output files for the source, I noticed several files like this:
\obj\Release\\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
Yes, it included that extra slash after Release. I had to add an exclusion (right click Source Files output -> ExcludeFilter) to exclude these files from installing. I added "*Temporary*" to exclude only these files.
Maybe someone else can explain why these temporary files were generated, all I know is that this fixed the issue. Hopefully this will help someone else looking for this topic.
I know its a Old question, but like #Riccaforte I was having some trouble to fix this in Visual Studio 2015. What I did was just delete all my Source Files inside my Aplication Folder, and I don't know why, but it did the trick.
If you remove a directory or directories from the Directory Table, This will cause an issue with other tables still using those directory variables.
My 2727 error message was the result of a *.png file I had added as a link to my project. "Copy to Output Directory" was set to "Copy if newer". Somehow the Visual Studio Setup Project was not able to resolve the path to the *.png file and added an invalid path to the installer.
LessMSI helped to find the problem https://lessmsi.activescott.com/ and removing the link in the project and adding the files in the installer project solved the problem.
Hope someone finds this helpful
regards

Resources