Why is Visual Studio 2010 not able to find/open PDB files?

Visual StudioVisual Studio-2010Visual C++Opencv

Visual Studio Problem Overview


I am trying to use OpenCV in VS 2010. I am an amateur, and I am learning first steps from the OpenCV wiki. However, when trying to debug my project, I get the following errors:

> 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file > 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file > 'C:\Windows\SysWOW64\kernellbase.dll', Cannot find or open the PDB file

I have those files in the right directory, so why can't it open them? What should I do to fix the problem?

Visual Studio Solutions


Solution 1 - Visual Studio

First change the following parameters:

Tools -> Options -> Debugging -> Symbols -> Server -> Yes

Then press Ctrl+F5 and you will see amazing things.

Solution 2 - Visual Studio

I'm pretty sure those are warnings, not errors. Your project should still run just fine.

However, since you should always try to fix compiler warnings, let's see what we can discover. I'm not at all familiar with OpenCV, and you don't link to the wiki tutorial that you're following. But it looks to me like the problem is that you're running a 64-bit version of Windows (as evidenced by the "SysWOW64" folder in the path to the DLL files), but the OpenCV stuff that you're trying is built for a 32-bit platform. So you might need to rebuild the project using CMake, as explained here.

More specifically, the files that are listed are Windows system files. PDB files contain debugging information that Visual Studio uses to allow you to step into and debug compiled code. You don't actually need the PDB files for system libraries to be able to debug your own code. But if you want, you can download the symbols for the system libraries as well. Go to the "Debug" menu, click on "Options and Settings", and scroll down the listbox on the right until you see "Enable source server support". Make sure that option is checked. Then, in the treeview to the left, click on "Symbols", and make sure that the "Microsoft Symbol Servers" option is selected. Click OK to dismiss the dialog, and then try rebuilding.

Solution 3 - Visual Studio

Visual Studio Community Edition 2015

Been having this error all day. I finally fixed it by going to Tools>Import and Export Settings> Reset all options > Reset General Settings.

Once it's reset go to Tools>Options>Debugging>Symbols> -- Then Check the box next to Microsoft Symbol Servers.

Run your app in debug mode, and it will open up windows saying it's downloading Symbols for a bunch of different .dll files. Let it finish doing this.

Once it completes, it should work again.

Solution 4 - Visual Studio

I had the same problem. It turns out that, compiling a project I got from someone else, I haven't set the correct StartUp project (right click on the desired startup project in the solution explorer and pick "set as StartUp Project"). Maybe this will help, cheers.

Solution 5 - Visual Studio

Referring to the first thread / another possibility VS cant open or find pdb file of the process is when you have your executable running in the background. I was working with mpiexec and ran into this issue. Always check your task manager and kill any exec process that your gonna build in your project. Once I did that, it debugged or built fine.

Also, if you try to continue with the warning , the breakpoints would not be hit and it would not have the current executable

Solution 6 - Visual Studio

For VS2013 users who find themselves here as I did:

Tools -> Options -> Debugging -> Symbols

You'll see that the Cache symbols in this directory: field is empty; you can either browse/enter the path yourself or just go ahead and click the Load all symbols button. An alert window will appear saying "Since you haven't selected a symbol-cache directory the default will be used". You'll now see C:\Users\XXXX\AppData\Local\Temp\SymbolCache in the previously empty path-field. Click Load all symbols a second time and you should be set. Hit ok, and just for the sake of diligence, clean and rebuild your solution.

Solution 7 - Visual Studio

I've found that these errors sometimes are from lack of permissions when compiling a project - so I run as administrator to get it to work properly.

Solution 8 - Visual Studio

I'm having the same warnings. I'm not sure it's a matter of 32 vs 64 bits. Just loaded the new symbols and some problems were solved, but the ones regarding OpenCV still persist. This is an extract of the output with solved vs unsolved issue:

> 'OpenCV_helloworld.exe': Loaded > 'C:\OpenCV2.2\bin\opencv_imgproc220d.dll', Cannot find or open the PDB > file > > 'OpenCV_helloworld.exe': Loaded 'C:\WINDOWS\system32\imm32.dll', > Symbols loaded (source information stripped).

The code is exiting 0 in case someone will ask.

> The program '[4424] OpenCV_helloworld.exe: Native' has exited with > code 0 (0x0).

Solution 9 - Visual Studio

I had the same problem. Debugging does not work with the stuff that comes with the OpenCV executable. you have to build your own binarys.
Then enable Microsoft Symbol Servers in Debug->options and settings->debug->symbols

Solution 10 - Visual Studio

I ran into the same issue. When I ran my Unit Test on C++ code, I got an error that said "Cannot find or open the PDB file".

Logs

When I looked at the Output log in Visual Studio, I saw that it was looking in the wrong folder. I had renamed the WinUnit folder, but something in the WinUnit code was looking for the PDB file using the old folder name. I guess they hard-coded it.

Found the Problem

When I first downloaded and unzipped the WinUnit files, the main folder was called "WinUnit-1.2.0909.1". After I unzipped the file, I renamed the folder to "WinUnit" since it's easier to type during Visual Studio project setup. But apparently this broke the ability to find the PDB file, even though I setup everything according to the WinUnit documentation.

My Fix

I changed the folder name back to the original, and it works.

Weird.

Solution 11 - Visual Studio

Had the same problem here but a different solution worked.

First, I tried the following, none of which worked:

  1. Load symbols as suggested by seanlitow

  2. Remove/Add reference to PresentationFramework and PresentationCore

  3. Restart system

The solution was to undo the last few changes I had made to my code. I had just added a couple radio buttons and event handlers for checked and unchecked events. After removing my recent changes everything compiled. I then added my exact changes back and everything compiled properly. I don't understand why this worked - only thing I can think of is a problem with my VS Solution. Anyway, if none of the other suggestions work, you might try reverting back your most recent changes. NOTE: if you close & re-open Visual Studio your undo history is lost.. so you might try this before you close VS.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionHamidRezaHamidiEsfahaniView Question on Stackoverflow
Solution 1 - Visual StudioseanlitowView Answer on Stackoverflow
Solution 2 - Visual StudioCody GrayView Answer on Stackoverflow
Solution 3 - Visual StudioNobodyView Answer on Stackoverflow
Solution 4 - Visual StudioJurek StefanowiczView Answer on Stackoverflow
Solution 5 - Visual StudioMpiView Answer on Stackoverflow
Solution 6 - Visual StudioahallView Answer on Stackoverflow
Solution 7 - Visual StudioSinisterRainbowView Answer on Stackoverflow
Solution 8 - Visual StudiosparaflAshView Answer on Stackoverflow
Solution 9 - Visual Studiojohn ktejikView Answer on Stackoverflow
Solution 10 - Visual Studiouser2384458View Answer on Stackoverflow
Solution 11 - Visual StudioThomas BaileyView Answer on Stackoverflow