I am debugging a VS 2008 C++ project. The project links to a static lib whose PDB file is present in same folder as the .lib file. It used to be all OK. PDB of lib file is loaded and source file is accessible during debugging. But now it suddenly fail to load with no change at all.
So how do I diagnose in VC++ to make sure the pdb is found and loaded by IDE?
UPDATE:
I changed EXE project setting to be "YES" for "Use library dependency inputs", and now I can access source code of the lib now, though it doesn't answer my initial question of why pdb of lib suddenly fails to load.
Further Question
My understanding is: EXE file statically links to LIB file, so all referenced binary code in LIB are already included in EXE binary. So do I actually need LIB file present? And, do I need LIB pdb file present or are the debugging info integrated into EXE's pdb file as well?
Related
I've got a third party executable with related .pdb and .idb files. I load Visual Studio Community and open this executable as solution.
After trying to debug I see no info, in the modules window the following message appears for the exe: Binary was not built with debug information
Both the pdb and idb files are in the same folder as the executable, in the same folder, and I've added that folder to the proper section in tools > options > debugging > symbols.
Still the same message.
I am working on a speech recognition children's game using an external API that I want to use on my project. Said API has lib files, dll files, header files and cpp files. As of right now I have successfully added the library files (at least I think I have) to my project directory, added all the necessary header files to external dependencies and I am left to add two .dll files to my project. First, I add my Audio.dll file and it gets added perfectly with no issues. Second, I add my Speech.dll and here is where my problem arises. I don't receieve any errors in my debug error list, however, the output of my project looks like this:
'Project.exe' (Win32): Loaded 'C:\Path\Project.exe'. Symbols loaded.
'Project.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. Cannot find or open the PDB file.
'Project.exe' (Win32): Loaded 'C:\Windows\System32\mscoree.dll'. Cannot find or open the PDB file.
'Project.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. Cannot find or open the PDB file.
'Project.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. Cannot find or open the PDB file.
'Project.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbased.dll'. Cannot find or open the PDB file.
'Project.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140d.dll'. Cannot find or open the PDB file.
The thread 0x3274 has exited with code -1073741515 (0xc0000135).
The thread 0x198c has exited with code -1073741515 (0xc0000135).
The program '[17020] Project.exe' has exited with code -1073741515 (0xc0000135) 'A dependent dll was not found'.
After this I get a popup System Error: The code execution cannot proceed because Speech.dll was not found. Reinstalling the program may fix this problem.
No mention of Audio.dll, however, Speech.dll which is in the same folder as Audio.dll isn't being found. I tried reinstalling the .dll, I tried reinstalling Visual Studio 2017, I tried Add->Existing Item->.dll, I tried adding the dll to the project path where the .exe is and I've tried adding it to every folder/subfolder all receiving the same sequence as my output.
My question is, how do I get my visual studio 2017 project to recognize my Speech.dll file?
Please ensure that the speech.dll is present in the same folder that your project.exe is located.
Windows searches for the dlls in the following order:
Your application's folder
\windows\system32
etc, according to the Windows defined path
Please ensure that the dll is present in any of these folders, otherwise you will get an error that the dll missing.
Note: If you are debugging then ensure that you have set the Working Directory for debugging correctly to point to the folder containing your project.exe and the dll.
In Visual Studio 2019 (I'm not aware if this would work on earlier versions),you can copy the DLL as part of the of the build process. Basically you would need to add a post-build event to your project. The post-build event would copy the DLL to your build output directory.
For specifying build events see:
https://learn.microsoft.com/en-us/cpp/build/specifying-build-events?view=msvc-160
The command you would use for the post-build event would be:
xcopy /y /d "<relative path or absolute path to dll location>/youlib.dll" "$(outdir)"
I'm using a symbol/source server to store private nuget packages. The packages are built using the "nuget pack" command using the -symbols flag and then pushed to the server.
Visual Studio (2015) correctly loads the symbols/source from the server the first time that particular package is being debugged. The problem occurs when I try to debug a different version of that package. Whenever there is any version of a source file available in the SymbolCache directory, Visual Studio will use that one to debug.
When I clear the SymbolCache directory, it does load the correct file version again from the symbol/source server and puts it in the SymbolCache.
example:
I have a package "testpackage" with version 1.0.1 being used by Application-A and Application-B uses testpackage version 1.0.2
I debug into code from testpackage through Application-B
The source files for testpackage 1.0.2 are copied to the SymbolCache directory and used correctly while debugging
I debug into code from testpackage through Application-A
The source files from version 1.0.2 are used instead of 1.0.1
In step 6 I would expect version 1.0.1 to be copied to the SymbolCache directory and used in debugging
I checked the Modules window during debug, and it shows that the correct pdb is loaded from cache, or if not present the pdb is loaded from the symbol server. There is a directory with symbol files for each package version.
Even though the correct symbol file is used, it still loads the wrong source file until I clear the SymbolCache.
Visual Studio loads the incorrect file version from SymbolCache for debugging
This issue may caused by mismatch of the pdb file. You can select Debug -> Windows -> Modules, on the Modules window, right click the symbol item, select Symbol Load Information, from the pop up window, you can see whether the pdb file is loaded and where the pdb file is loaded from.
If the pdb file is loaded from incorrect path, you may specify a correct symbol location by clicking the Symbol Settingsā¦ button (on theĀ Symbol Load Information dialog).
If the pdb file is loaded from correct place, your issue may caused by mismatch of the pdb file, clear the SymbolCache directory and reload it from the symbol/source server may help.
AFAIK, If your SymbolCache folder had the old version symbols file which was downloaded from the Symbol Server before, it would not download it again during you debug your app. One possible reason is that since your symbol file has the same name but in different versions, the VS debugging would search and load the symbol file from your SymbolCache folder firstly, and then download it from the symbol server or others if your SymbolCache folder has no them. That's the reason why you got this issue.
A workarounds I could suggest: Using different names would be better.
Hope this can help you understand this question.
I've tried all day to get VS2010 to run my program. I can only get the program to find the DLLs if I copy and paste them into the same folder as the output exe.
I have listed the folders containing the DLLs I need included under Linker > General. But running the program still gives me errors such as:
"The program can't start because tbb_debug.dll is missing from your computer. Try reinstalling the program to fix this problem."
What can be going wrong? I am trying to include 2 packages which have VS2010 DLL binaries; TBB (Intel package) and Open-CV (Which comes with both DLLs and LIB files). For the lib files I am also setting them as linker inputs, though the TBB package does not come with vs2010 lib files.
I am entering full paths in the Linker settings, such as: "C:\opencv\build\common\tbb\ia32\vc10", where each folder contains DLL files.
The linker is only looking for .lib files, which "point" the executable to the adresses of the functions in the dll. It has nothing to do where your executable will find the DLLs.
You need to have the DLL either in the directory of the exe - this is default search path, and is the simplest solution.
It gets slightly more complicated if you have different versions of DLLs installed which require side-by-side configuration. Then you need a manifest which tells your exe where to look for the dlls. Then you give the dll to the windows SxS cache.
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 :)