Can't Build PortAudio - "LNK1104: cannot open file 'ksguid.lib'" - c++

I'm a beginner in C/C++, so please bear with me.
I'm trying to build the PortAudio library so I can use it in one of my project. I'm using VS 2013, the preset project-file for builds had to be converted to my version. I've been able to fix all the many problems that occurred on my long way here, except one:
LINK : fatal error LNK1104: cannot open file 'ksguid.lib'
I've seen this and this site. All of them address exactly this problem, yet non of them has been able to solve it. Here are the solutions these sites suggest:
Add WASAPI - symbol to portaudio.def,
Add PA_WDMKS_NO_KSGUID_LIB - definition to the preprocessor

You can get the ksguid.lib-file from the Windows 7 SDK. It might even already be installed on your computer. It's best to use the explorer to find it (probably C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64).
When you found it, go back to Visual Studio and go to Project > Properties > Configuration-Properties > Linker > Input, then click on the little arrow on the right of Additional Dependencies and choose edit:
Enter the absolute filepath to ksguid.lib. Make sure that you surrounded it with "-s and that you put a ; at the end. (Throws an error without a usable description otherwise - Microsoft as we know it.)
Source: Bitbucket, stackoverflow

ksguid.lib is included in the Windows 7, 8, 8.1, and windows 10 sdk. The answer provided by #Nearoo is perfectly valid. This alternative answer involves modifying what directories the portaudio Visual Studio project looks for library files.
For reference, I'm using Visual Studio 2013 on a Windows 8.1 PC.
Navigate to: Project -> Properties -> VC++ Directories
At the top of the window,
change Configuration to "All Configurations".
change Platform to "All Platforms"
In the "Library Directories" portion, add the following path:
$(WindowsSdkDir)\Lib\winv6.3\km\$(PlatformTarget)\
This nice thing is that this one path uses macros so it will work with Debug, Release, 32 bit and 64 bit builds of portaudio.

Related

VS 2017: fatal error RC1015: cannot open include file 'winres.h'

I just downloaded Visual Studio 2017 and converted my dialog-based C++/MFC project with it (from Visual Studio 2008 SP1.) But then when I go to Resources it shows this error:
fatal error RC1015: cannot open include file 'winres.h'
And idea how to fix this?
I just also came across this issue. It seems my friend missed to push some VS 2017 meta file to the server. My quick solution is to change the Windows SDK version to match the Windows 10 OS version or below.
You can check your OS version from the cmd tool.
Jeff T. answer is great if you have a single project.
If you have many projects in which you have to change the target Windows SDK (or if you want to make sure they all match), you'll probably prefer to use the Retarget Solution button found when right clicking on the solution:
Then just select some Windows SDK version that you have installed, and apply it to all (or whatever) projects you need to change:
That list of Windows SDK versions will probably show some that don't really work. You might have to try.
The missing files are located in two directories:
C:\Program Files\Windows Kits\10\Include\10.0.15063.0\um
C:\Program Files\Windows Kits\10\Include\10.0.15063.0\shared
Add the two paths to project properties (Project >> ...Properties >> Configuration Properties >> VC++ Directories >> Include Directories).
You should install the framework MFC
For anyone who stumbles onto this question is in the same boat as me (tried all of the above with no luck)..
I just created a fresh project and created a resource immediately (no issue) and then went ahead and readded all the code / libs that were needed. A bit annoying but I'm sure it was a mistake I made while configuring the project settings
Hopefully this helps someone out
I my case, it was caused by wrong project configuration. Specifically Property Pages -> VC++ Directories -> Include Directories and there check Inherit from parent or project defaults.
Probably VS2017 fatal error RC1015 when attempting to add a new resource. fellow also got this error with VS2017.

can't setup openGL superBible examples due to problems finding Windows.h

I'm trying to compile the examples from the book OpenGL SuperBible 6th edition.
I got everything from their git repository and I'm trying to open it using Visual studio 2013 by opening the visual studio 2013 solution file that is included.
When I try building the main project inside "sb6_vs2013" It claims it can't find Windows.h : "Error 2 error C1083: Cannot open include file: 'windows.h': No such file or directory"
Now I tried to look at people's solutions on the internet and couldn't find anything helpful.
If I right click on the project and go to properties -> Configuration Properties - > VC directories I can see that it has the line:
$(WindowsSdkDir)\include
When I click on Macros I can see the path of WindowsSdkDir, its pointing to the right place where Windows SDK is, which in my case is: "C:\Program Files (x86)\Windows Kits\8.1" if I look at my file system in that folder and go to "\Include\um\" I can find Windows.h there, but for some reason visual studio 2013 fails to find it.
I thought it was due to bad installation and I even went as far as re-installing windows, visual studio and everything (it was time for that anyway) but nothing seems to fix this problem, even the new fresh installation didn't do the trick.
I'm not sure what else I can do to make this work.
Could someone help me solve this issue once and for all?
Eventually I managed to solved it, after the reinstall all the macros were correct I just need to check "inherit from parent on project defaults" checkbox and it did the trick

Profile a c++ win32 console application with Visual Studio 2012

I have a simple (not so simple) win32 console application in c++. I would like to profile this application, but when I try to:
DEBUG > Start Performance Analysis
An error occurs: "No launchable projects are available for profiling".
Please note that the project compiles and runs normally. It's jus the profling that is not working.
How can I solve? I am on Windows 8 with Visual Studio Ultimate 2012
Note that I choose for this project a simple:
File > New Project > Win32 > Win32 Console Application (C++)
I would like to obtain something like xcode does.
A simple list for each functions or methods the cumulative time of usage.
This is the error when I try "Start performance analysis"
Note
I have tried both release mode and debug mode with both x64 and or Win32
Note2
In this project I have created two custom property sheet (to include the right opencv libraries)
- OpenCV-Release
- OpenCV-Debug
Note3
Open the projects properties.> Configration Manager > Active Solution Platform > select New > and follow my screen shot. Your perfomance analysis will run after this.
The project is not being recognised, as you have it configured with x64. (As evidenced by your first screenshot under Note)
Win32
As your project is created in the 64bit os, you need to manually link the project with the win32 sys, so the profiler will recognize the project as a win32 project.
http://en.wikipedia.org/wiki/Windows_API
I will leave this here, as it may be useful for some users.
Saving projects in Visual Studio, must be done methodically and consistently.
If a project is created and saved in a folder (for example) Folder A within the C drive and then later the folders are rearranged and the project is then in Folder A, but folder A has been moved to the D drive (or any variation of changes). Visual Studio, will not be able to find the project.
Be sure to check that all your files for this project are in the correct folders. You need to open the sub folder and make sure that all the files for your project are present.
Please see my screen shots. It doesn't matter why my folders are arranged, as they are, suffice to say, I have found it easier to keep them with the program files in the C drive.
Please note the file in the first screen shot extension vspx, is a visual studio performance report.
Visual Studio Project Folder
Visual Studio Sub Folder
This may or may not answer your question. Please advise if you need more assistance.
The short cut-
VS Release
The long steps - which give you more options
VS Debug menu
VS Configuraion Manager
Please try this (it is the same answer on both links):
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/56dcdb2a-5e30-4015-bc14-244f99f07b8b
Profiling with CMake, C++, and Visual Studio 2012
And this link as well.
Add the files to a directory outside of the project and then reference those directories in the "Additional Include Directories" in Properties -> Configuration Properties -> C/C++ -> General.
VC++ Visual Studio added .hpp files in subdirectory but get "Error: cannot open source file ..."
You can launch the performance wizard, under the Analyze tab.
This is a known bug in VS.
Without seeing your computer, it is hard to know what else, I can suggest. I do know that it's important to go through all the suggested steps to trouble shoot. If I can find anything else, I'll let you know.
Please note my project is a downloaded sample.

openCV program compiles but crashes on run

I just started using openCV (version 2.4.1) in visual studio 2008 on windows 7. I did the installation and the "hello world" program as described in
http://opencv.willowgarage.com/wiki/VisualC%2B%2B
and
How to install OpenCV 2.0 on win32
Thanks to these instruction my program compiles fine without any errors. But when I first ran it I got error that files opencv_core241d.dll and tbb_debug.dll are missing. So obviously something didn't get set right but as per the instruction in first link I copied these files to the same folder where the exe is sitting, Ran it third time and now I am getting the popup about libgcc_s_dw2-1.dll missing. I have done a search on my computer and no such dll is available.
I have researched this online and haven't seen any real solution online about some issues like this. My guess is with the multiple dll being missing openCV didn;t get installed properly but I have no idea what really is going on.
Any help is desperately needed and will be appreciated heavily by my hairs and scalp.
Follow these steps and try.
Extract OpenCV 2.4.x into your main partition (I'll assume C\{opencvdir})
Add C\{opencvdir}\build\x86\vc9\bin to environmental variable's path variable. And restart your computer (These settings are for 32bit (x86) Windows version and Visual Studio 2008 (VC9)).
Now create a new Visual Studio project and add your sample OpenCV code.
Go to project Properties -> Configuration Properties -> C/C++ -> General -> Additional Directories and add:
"C\{opencvdir}\include";
"C\{opencvdir}\include\opencv";
"C\{opencvdir}\include\opencv2"
Go to project Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies and add:
"C\{opencvdir}\build\x86\vc9\lib\opencv_core240.lib";
"C\{opencvdir}\build\x86\vc9\lib\opencv_highgui240.lib";
"C\{opencvdir}\build\x86\vc9\lib\opencv_imgproc240.lib";
"C\{opencvdir}\build\x86\vc9\lib\opencv_video240.lib"
(These libraries are for a basic application. Add more as your application needs them).
Now run your project.
P.S. My recommendation is to use Visual Studio 2010 with OpenCV 2.3.x or higher.

MSVCP100D.dll missing

When I try to debug my C++ application I get the error
The program can't start because MSVCP100D.dll is missing from your
computer. Try reinstalling the program to fix this problem.
I found someone with a similar problem here: Remote debugging C++ on the Windows Server 2008 platform with VS2010; MSVCP100D.dll missing however the solution given there doesn't seem to show up when I go to the solution properties.
Would reinstalling Visual Studio fix this problem?
Usually you don't want MSVCP100D.dll on your system. It's for debugging purposes only. If you get this error for your release build you must make sure that you didn't accidently add a 'Debug'-tagged Project Output to your setup project.
If you really need to debug your software on a remote machine, I suggest you do the following:
Create a new Setup project called 'CRTDebug100Setup' and add the following Merge Modules (found under C:\Program Files\Common Files\Merge Modules):
Microsoft_VC90_DebugCRT_x86.msm
policy_9_0_Microsoft_VC90_DebugCRT_x86.msm
Build, and deploy on your computer to be debugged!
Reinstalling Visual Studio fixed the problem.
This can also occur if Generate Debug info is not set to No
Configuration Properties -> Linker -> Debugging -> Generate Debug info
Followup on l33t's answer above (tried to revise it but it did not seem to appear).
Added later by gpicher 10 Jan 2012: I believe those .msm packages would be for a 9.x version of the DLL in question, not a 10.x version. I resolved a similar problem I had by making a setup project with Visual Studio 2010 installed on a 64 bit Windows installation, using the merge module Microsoft_VC100_DebugCRT_x86.msm in the folder C:\Program Files (x86)\Common Files\Merge Modules. There's a similar x64 version of the .msm if the application showing the error dialog is a 64 bit application. In this case a third party was providing me a debug build of their application in order to develop and test new plugin code against, so I couldn't change build settings, and wanted the debug functionality.
Find the Visual Studio 2010 install iso file.
Extract cab44.cab file from the ISO.
Then extract file "F_REDIST_DLL_APPLOCAL_msvcp100d_x86" from the .cab file using 7z.
Rename the file to msvcp100d.dll.
For x64 version. The cab file name is cab26.cab and the file name is F_REDIST_DLL_APPLOCAL_msvcp100d_x64.
For similar issue such missing msvcr*d.dll for another visual studio version. Here is the way I used to find the answer:
Find the Visual Studio ISO.
Extract all the .cab file.
7z.exe t *.cab > filelist.txt
gvim filelist.txt
searching for the interested file name. Hope this helps.