Linker Error When Changing Visual Studio Output to System32 - visual-studio

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

Related

VB6 compiling via console (vb.exe) compatibility issue on 64bit (works on 32bit?)

I'm using
cd C:\Program Files (x86)\Microsoft Visual Studio\VB98
vb6.exe /make Project1 /out %1
To basically compile my application, and I'm getting a compatibility issue (Saying doesn't work on my type of windows).
When compiling with the VB6 IDE (Make .exe) that works perfectly on my machine but this isn't, does anybody know how to fix this? Thanks
Error I receive when trying to open executable: "This version of this file is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 32-bit or a x64 64-bit version of the program, the contact the software publisher".
& It's a standard EXE application also.
I've tried running it as a administrator, trouble shooting / changing the compatibility to windows XP service pack 2 & 3, still didn't work.
Work prefer a good fix to this, like if there's anything I can do via console as a option or something or some option or anything.
Cheers! Please help ASAP
From the discussion in the comments, I believe the answer here is as follows (as identified by GSerg):
The problem is your use of the /make switch on the command line. The documentation says this about /out:
Outputs errors to a file when used with the /make or /makedll switch.
So, if you used vb6.exe /make Project1 /out Project1.exe, then Project1.exe would actually be a text file containing the error output from the compiler and thus would not be an actual executable, even though it had an .exe extension.
You actually don't specify the output binary when you use /make. The help output from running VB6.exe /? is a little more explicit:
Tells Visual Basic to compile projectname and make an executable file
from it, using the existing settings stored in the project file.
VB remembers the last filename and directory you used for compiling your project in the IDE, and it stores that in the .vbp file:
ExeName32="Project1.exe"
Path32="..\output"
I use a batch file to handle this issue. It sets the path to include both the 32-bit and 64-bit versions of the Program Files directories. Then just reference 'vb6.exe' and the correct one will be pulled from your path.
set PATH=c:"\Program Files (x86)\Microsoft Visual Studio\VC98\bin"
set PATH=%PATH%;c:"\Program Files (x86)\Microsoft Visual Studio\VB98"
set PATH=%PATH%;c:"\Program Files\Microsoft Visual Studio\VC98\bin"
set PATH=%PATH%;c:"\Program Files\Microsoft Visual Studio\VB98"
vb6 /m foobar.vpb

Linking errors with boost, VS2010, and CMake

I have searched high and low for this answer. I have tried suggestions to similar problems posted on Stack and other sites. My toolchain consists of an x64 machine with windows 7, visual studio 2010, opencv 2.4, qt 4.8, and boost. I configure all of my projects using CMake, which finds all of these libraries and includes and creates my visual studio project. I have compiled two versions of boost, a 32-bit version build in the command line and placed in \boost\boost_1_47_0\lib\win32, and a 64-bit compiled in the Windows SDK v7.1 64-bit compiler and stored in \boost\boost_1_47_0\lib\x64. Everything in the project compiles fine with the exception of boost. I get a compiler error:
fatal error LNK1104: cannot open file 'libboost_filesystem-vc100-mt-1_47.lib'
As a reminder, CMake is handling all of my linking and it properly locates this lib and adds it to the visual studio project. I can verify this by looking at Properties->Linker->Command Line. Here, in addition to files representing other libraries, it has listed:
"C:\Tools\boost\boost_1_47_0\lib\x64\boost_filesystem-vc100-mt-1_47.lib"
"C:\Tools\boost\boost_1_47_0\lib\x64\boost_program_options-vc100-mt-1_47.lib"
"C:\Tools\boost\boost_1_47_0\lib\x64\boost_date_time-vc100-mt-1_47.lib"
"C:\Tools\boost\boost_1_47_0\lib\x64\boost_thread-vc100-mt-1_47.lib"
I can suppress this error by manually adding my boost\boost_1_47_0\lib\x64 directory to Properties->Linker->General->Additional Library Dependencies. This compiles without error. However, when I go to run the application, I am met with a system error that tells me:
The program can't start because boost_filesystem-vc100-mt-1_47.dll is missing from your computer. Try reinstalling the program to fix this problem.
In this /x64 directory I have:
boost_filesystem-vc100-mt-1_47.dll
boost_filesystem-vc100-mt-1_47.lib
libboost_filesystem-vc-100-mt-1_47.dll
Any insight would be incredibly appreciated. Thanks!
To solve the runtime error:
Add the location of the dll(s) to the PATH environment variable.
For example on my machine:
set PATH=%PATH%;c:\users\chris\boost_regex-vc140.1.63.0.0\lib\native\address-model-32\lib
or copy the dll(s) to a directory already in the PATH
See here: https://msdn.microsoft.com/en-us/library/7d83bc18.aspx?f=255&MSPPError=-2147217396

fatal error lnk1104: can't open LNKn.tmp

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!

Visual Studio Project "Release" (x86) build can not load a DLL (msobj100.dll)

I have a really simple project that I am trying to build with Visual Studio 2010 Express (x64) edition (C++). It contains only 1 file (main.cpp) that is used to find the machine epsilon on my machine and does nothing else. When I try to compile a Debug x86 build everything works fine and an .exe is generated but I would like to make a release build as I need to turn this code is as a HW assignment. When I try and compile a Release (x86) build it fails with the following error -
1>LINK : fatal error LNK1296: unable to load msobj100.dll
I ran a search and the only place I found a file called msobj100.dll is in "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64" so I tried adding that location to the solution's VC Directories -> Executable Directories line. It didn't work. Why does the Release build complain about this DLL when the Debug build does not? I have compared both build pages and can not seem to find any differences in their dependencies or directory locations. I would really like to know what is going on. Thanks!
You're trying to load the 64-bit DLL in your x86 application, you can probably find msobj100.dll in C:\Windows\SysWow64

Building Qt for Visual Studio 2010 - cannot open file 'qtmaind.lib'

I'm trying to start a C++ Qt application and have it run and compile in Visual Studio 2010.
Doing some googling, I found that there was a Visual Studio Qt Add-in, and so I installed this. I already had a MinGW Qt binary installed, and when this did not work, I found that you have to compile the source for Visual Studio 2010 (the VS 2008 binary will cause deployment issues).
Using this as a guide: How to build Qt for Visual Studio 2010, I compiled the open source version, and added it to the PATH, along with a QTDIR env variable. Hoping that I got it finally working, I created a "Qt Application" using the New Project Wizard in Visual Studio 2010. Once I finished, I tried to build the program, only to see the following error:
1>LINK : fatal error LNK1104: cannot open file 'qtmaind.lib'
I looked in the C:\QT\lib folder, and found that I only have a qtmaind.prl, but no clue as to why there is no qtmaind.lib.
I am able to echo the QMAKESPEC environmental variable to get a 'win32-msvc2010' output.
I've tried several different combinations of flags for the configure step, including the one in the link, and even tried manually setting the -platform flag.
If anyone can offer any help, it would be greatly appreciated! :D
Just ran across this same problem. I changed the "-release" flag from the linked guide to "-debug-and-release", and then it built the qtmaind.lib library (presumably, that "d" suffix stands for debug).
I encountered this issue when running a project whose settings were hardcoded for a particular machine setup.
I could see that the vcxproj file had something like:
C:\Qt\4.8.1\libqtmaind.lib
I could not find this lib file in my machine. I replaced the line by:
C:\Qt\4.7.3\lib\Qtmaind.lib
It looks like the names of library files are different across Qt versions.Or, maybe the library files were renamed.
Also, the 'd' denoted debug. If you cannot find any lib file post-fixed by 'd', it is likely that you did not 'make' a debug version of Qt.
You can cross check this by opening the .Sln file created by configure. Mine was named Projects.sln. You can open this in notepad and see if win32-debug configurations are present.
This might be a QMAKESPEC issue. Try setting your QMAKESPEC environment variable to
win32-msvc2010
and rebuild Qt like that. This should give you .lib files in your Qt folder
in QT 5.3 with vs 2013
in properties -> linker -> input
remove ANY path for qt libraries such qtmaind.lib
this is known BUG

Resources