Psapi.lib not found when project is created by cmake - c++

I have a cmake that create a project for VS 2019. When I try to compile the code, I am getting that this library is not found:
Error LNK1104 cannot open file 'C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x64\Psapi.Lib'
Checking my system, I do not have 'C:\Program Files (x86)\Windows Kits' directory.
I made sure that during my VS installation, the C++ code development was selected and also I run a repair on installation to ensure that any missing file is installed, but I m still have the same issue.
What other software or library should I install to get this issue fixed?

I have Visual Studio 2022 and installed Win10 SDK 10.0.19041.0 via Visual Studio installer Desktop Development With C++. I am able to find Psapi.lib in directory C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x64. Try installing SDK from page: https://developer.microsoft.com/en-us/windows/downloads/sdk-archive/

Related

Install LibRaw from Github-Repo in Windows [duplicate]

I recently installed Visual Studio 2017 and need to change something in a C++ project.
But when I try to build, it says cl.exe is missing. None of the solutions provided online seem to work.
I do have a cl.exe, but it is located under this path:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64
I have also tried running vcvars32.bat, but that does not seem to make any changes.
And I have installed 'Desktop development with C++'.
I solved it by running vcvars.bat.
For Visual Studio Enterprise 2017 it is located under the following directory:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\vsdevcmd\ext

"The package System.Net.Http with version 4.1.1 could not be found in C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\."

I am trying to evaluate a software SDK for displaying PDF files. It comes with a few sample projects, but I am having problems building the C++ projects. I am pretty sure this is a problem with my local environment, but I have no idea how to fix it:
The projects come as a Visual Studio solution, to be used in Visual Studio 2017. Upon first opening it I was told to install missing features (VS17 was a plain install with no workloads before):
After installing that, and twiddling with platform toolset and the general platform target settings, I could finally build the C++ library part that creates a .dll file to be used by the other 2 C++ projects. (I could also confirm that this works fine, as the also included C# project used the library perfectly fine.)
But for the 2 remaining C++ projects I get this error on build:
The package System.Net.Http with version 4.1.1 could not be found in C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\. Run a NuGet package restore to download the package.
FunctionDemo
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets
377
Unfortunately I have no idea what "Use NuGet Package Restore to download them." means in that context - both the solution and all the projects have nothing listed when using Manage NuGet Packages... in Visual Studio. So I don't even know where this dependency comes from. (Are those part of the general SDKs I have installed maybe?)
Double clicking the error message opens C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets with this:
<ResolveNuGetPackageAssets Condition="Exists('$(FrameworkInjectionLockFile)')"
NuGetPackagesDirectory="$(FrameworkInjectionPackagesDirectory)"
RuntimeIdentifier="$(NuGetRuntimeIdentifier)"
TargetMonikers="$(NuGetTargetMonikerToInject)"
ProjectLockFile="$(FrameworkInjectionLockFile)">
But I guess this is pretty standard. Does this tell me something where the error comes from?
On the filesystem C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\System.Net.Http\4.1.1 indeed does not exist. Any tries to fill it manually (download the nuget package manually to a project, and copying the results here, using any solutions or commands to run I can find online) failed.
If found out that C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\ is the package source Microsoft Visual Studio Offline Packages which I can view via Options -> NuGet Package Manager -> Package Sources in Visual Studio 2017, but disabling it there didn't change anything about the error message.
Am I looking in the wrong place?
Is this really my local problem or a project problem?
How can I fix this problem?
I "fixed" this by getting the C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\System.Net.Http\4.1.1 folder from another developer. Then the error message switched to other packages, so in the end he sent me his full C:\Program Files (x86)\Microsoft SDKs\NuGetPackages and I copied folders over until it finally built.
Still not idea what caused this, must have been a missing payload or SDK that Visual Studio thinks was installed but really wasn't :/
Keeping the question unanswered though in the hopes that someone comes along that know the real fix.
This happened to me after upgrading from Visual Studio 2017 to 2019. While not the same file, my error was:
error APPX0702: Payload file 'C:\Program Files (x86)\Microsoft
SDKs\NuGetPackages\System.Private.ServiceModel\4.1.3\runtimes\win7\lib\netcore50\System.Private.ServiceModel.dll'
does not exist.
For whatever reason, after upgrading, both VS 2017 and VS 2019 were looking for this in C:\Program Files (x86)\Microsoft SDKs\NuGetPackages..., but I found it actually existed in the similarly named folder C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages... instead. I assume during the installation of VS 2019 this directory was created?
I manually copied the files over to where it was looking and then the build finally worked. The underlying issue isn't fixed, but maybe somebody smarter than me can explain why this happened in the first place.
For me disabling C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\ didn't work either. But then I had deleted it from Nuget.Config and it had finally solved the problem.

Parallel Installation of VS2017 and VS2015 breaks cmake (and more)

I installed Visual Studio 2017 15.4.0, then i installed VS2015 Update 3 (
C++ Language only).
I started VS2015 and tried to create a C++ Project (e.g. Console Application) but nothing happens, the dialog just does not close or continue. Only "Cancel" is possible. More important for me, i tried to configure a project (caffe2) as a VS2015 project, but cmake failes to find the VS2015 tool set.
The problem (or a part of the problem) is, that VS2015 normally installs its toolset (cl.exe etc.) to
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin
But because of VS2017, it uses now:
C:\Program Files (x86)\Microsoft Visual Studio\Shared\14.0\VC\bin
(see also Visual Studio 2015 Installer doesn't install cl.exe)
CMake (3.9.4) does not find the rc.exe or cl.exe of VS2015 anymore
I tried uninstalling both studios and reinstall them starting with VS2015, but VS2015 is still using the shared folder and not its own. (Even worth, i now got a mix of both folders, some minor important files are now duplicated). As a workaround, i started cmd.exe in "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC",renamed bin,lib,include,redist to bin#,lib#,... and used hardlinks like this
mklink /j bin "C:\Program Files (x86)\Microsoft Visual Studio\Shared\14.0\VC\bin"
mklink /j lib "C:\Program Files (x86)\Microsoft Visual Studio\Shared\14.0\VC\lib"
mklink /j redist "C:\Program Files (x86)\Microsoft Visual Studio\Shared\14.0\VC\redist"
mklink /j include "C:\Program Files (x86)\Microsoft Visual Studio\Shared\14.0\VC\include"
At least, cmake is now working again, but i still cannot create any projects with VS2015 anymore ( i do not need this VS2015 functionality really, but it makes a bad feeling having a broken installation)
Is anyone else having this trouble and got a better solution than the workaround above ?

How to install SignTool.exe for VS 2017?

After upgrade to VS 2017 i got
"Error An error occurred while signing: SignTool.exe not found."
But only using MSbuild on the Visual Studio publish there's no problem.
I already checked folder
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin"
and in fact there's no SignTool.exe present.
But there was before installing VS2017, any ideas?
I followed this issue but no luck
How to install SignTool.exe for Windows 10
Signtool is included with the Windows 10 SDK
Open Visual Studio installer.
Switch to the "Individual Components" tab
Choose the version of the SDK that suits your needs.
Multiple copies may be installed.
Start Developer Command Prompt for VS 2017 then it is in the path variable
signtool
That seems to do the trick, now the problem is with setup.bin file.
error MSB3147: Could not find required file 'setup.bin' in csproj folder
C:\Program Files (x86)\Microsoft SDKs\ClickOnce\SignTool>
This is where its there in my System.
The all solutions didn't worked for me ; finally i just copied signtool.exe to the project folder and then worked. You can download the signtool.exe from internet or install Windows 10 SDK by visual studio installer and then copy from "C:\Program Files (x86)\Microsoft SDKs\ClickOnce\SignTool".
I found it under C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin
It could be because it was there before the vs2017 installation.
It doesn't harm to check :)
So the problem I had with this was that the path variable wasn't set up. I ran
set PATH="C:\Program Files (x86)\Microsoft SDKs\ClickOnce\SignTool";%PATH%
in the Developer Command window before trying to sign anything.
If you do it this way you will need to run the set path every time you want to use it unless you add it to the path environment variable.
I hope this helps.

VC++ Building directshow baseclasses

I am a newbie to DirectX SDK, Platfrom SDK and DirectShow. I downloaded latest Platform SDK and DirectX SDK August'09. I tried to build sample project in folder:
Microsoft Platform SDK\Samples\Multimedia\DirectShow\Capture\PlayCap\
And had following building errors:
LINK : fatal error LNK1181: cannot open input file 'D:\Program Files\
Microsoft Platform SDK\samples\multimedia\directshow\baseclasses\
WIN2000_DEBUG\strmbasd.lib'
As far, as I understand, I need to build all sources in "Microsoft Platform SDK\Samples\Multimedia\DirectShow\BaseClasses\" directory to get necessary lib.
I tried nmake in that dir and got following:
D:\Program Files\Microsoft Platform SDK\Samples\Multimedia\DirectShow\
BaseClasses\ctlutil.h(278) : error C4430: missing type specifier - int
assumed. Note: C++ does not support default-int.
Here is code on that lines:
278: STDMETHODIMP
279: CMediaEvent::NonDelegatingQueryInterface(REFIID riid, void **ppv)
What I do wrong? Just can't believe, that using Microsoft's libraries must be so hard.
Microsoft has renamed Platfrom SDK to Windows SDK. The lastest Windows SDK is Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1.
Windows SDK for Windows 7 has Visual Studio 2008 2005 project files for all DirectShow projects.
On my Xp64 box, I managed to get the DirectShow baseclasses libs built in order to run the amcap sample. I have the June 2010 Microsoft DirectX SDK installed as well as the Microsoft Windows SDK for Windows 7 (7.1) with all the C/C++ compilers.
First, we have to compile the DirectShow baseclasses :
open a regular old cmd.exe
cd C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\multimedia\directshow\baseclasses
If you're getting an error about not have VCBuild.exe installed, it's because the
sln and various project files (eg: C/C++ vcproj) are ancient, the next command will
upgrade them nicely, changing old stanky vcproj files into new crappy vcxproj files
VCUpgrade is here on my machine :
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\vcupgrade.exe
Note that even after trying the various combinations of params to vcupgrade,
building the sln with msbuild is a no-go (docs be danged), so I had to directly
compile the project I left the batch file var named SLN anyway because I'm a real revolutionary
VCUpgrade -nologo -overwrite baseclasses.vcproj
This makes it a touch easier to compile different configurations
set SLN="baseclasses.vcxproj"
Note that the baseclasses Release build makes strmbase.lib
and Debug makes strmbasd.lib
amcap needs the Release build tho amcap's build can be debug
A) Compile Release Win32 (== x86)
Using the MsSdk's SetEnv.Cmd lets you avoid all that vsvars32.bat quagmire as well
as the 8 million different cmd shells that have been specially designed to be one
or two fatal flaws away from actually working while relying upon an eplipsy-inducing web of
batch files to do they thing (hey! maybe the two are related!?)
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /release /x86 /xp
I've not had any luck using the 64-bit version of MSBuild (maybe targets?),
but x86 MSBuild has been working no problem
"C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" %SLN% /p:Configuration=Release /p:Platform=Win32
B) Compile Release X64
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /release /x64 /2003
"C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" %SLN% /p:Configuration=Release /p:Platform=X64
Second, we can now compile both versions of amcap
open a regular old cmd.exe
cd C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\multimedia\directshow\capture\amcap
VCUpgrade the vcproj to a vcxproj
VCUpgrade -nologo -overwrite amcap.vcproj
set SLN="amcap.vcxproj"
A) Compile Debug Win32 (== x86)
Set compiler,lib,include,... paths and then compile
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /debug /x86 /xp
"C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" %SLN% /p:Configuration=Debug /p:Platform=Win32
B) Compile Debug X64
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /debug /x64 /2003
"C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" %SLN% /p:Configuration=Debug /p:Platform=X64
I used SysInternals *Process Explorer* to verify that each exe was actually 32-bit and 64-bit respectively. It seems inexplicable that most developers I've worked with don't even know about Process Explorer -- I'm in that thing all day. And yes, that is what she said.
For me this error meant "open C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\multimedia\directshow\baseclasses\baseclasses.sln" (in my case, in visual studio express 2010) it asks to convert it, do so, then build both "release" and "debug."
Then in your own project, under project settings for your project
example: add
G:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\multimedia\directshow\baseclasses
to beginning of “VC++ directories” include path, and G:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\multimedia\directshow\baseclasses\debug to your lib path (anywhere in that).
See also https://msdn.microsoft.com/en-us/library/windows/desktop/dd407279(v=vs.85).aspx