Error codes when debugging in Visual Studio 2013 for C++ - c++

My C++ code in Visual Studio Express 2013 (code replicated from a programming book I was using) generates a whole bunch of errors too long to list here... But each error is the same problem:
"Cannot find or open the PDB file."
An example of one file it was trying to find/open is: C:\Windows\SysWOW64\KernelBase.dll
Anyone got any suggestions? I'm a total newbie so please use plain words!
Cheers.

When you build a binary with VS, VS creates a program database for it. When debugging a process, VS searches for debug symbols next to the binary.
As long as you don't need these symbols (to set a breakpoint in e.g. WaitForSingleObject or so), you don't need the .pdb either.
However, when the debugger tries to construct a call stack, it often does need the symbols (it will tell you that 'frames might not be correct'). In that case, you can tell VS to retrieve the microsoft program databases from the Microsoft Symbol Servers.
Note: when all this symbol-loading slows down your process, there are settings to disable automatically loading them.

Related

C++ Microsoft Visual Studio 2015 Debug issue (Cannot find or open the PDB file.)

Very new to coding as well as compilers. I have recently started learning C++ and have been attempting to use Microsoft Visual Studio 2015 as my compiler. Unfortunately every time I try to compile even the simplest of programs, I continuously get the same error. I have looked for other solutions but everything seems to be outdated showing either 2010 or 2013 Microsoft VS. I have tried editing the debug options, "Load dll exports (Native Only) as I saw that that could have been a possible solutions but that also did not solve the issue. If anyone can help me out it would be very much appreciated, also if you could explain the issue as simply as possible it would also be much appreciated as I said before, I know very little about coding or the compilers yet.
In Debug -> Options -> Symbols check if you have folder where you have PDBs and Microsoft Server. Also create folder for Cache, and have "Load all modules" checked
Get Debug -> Windows -> Modules, and start app step by step. Go inside until you see you app in Modules, right click on your module and try to force loading symbols.

Attaching Visual Studio 2012 to Matlab 2014a(32 bit): tbb.dll

I am encountering a strange problem.
1>I open visual studio 2012
2> I open matlab 2014a (32 bit)
3> I try "Attach to process" and put the matlab process from the list displayed in the process window that comes up.
What happens is I get window in visual studio saying
"Loading symbols for tbb.dll from:
z:\itt\branch_tbb40\tbb\1.0\build\fxeowin18vc10_32_release
Attempting to cancel will disable furhter symbol loading"
and hangs.
The issue is "z:\itt\branch_tbb40\tbb\1.0\build\fxeowin18vc10_32_release" does not exist in my computer. How come visual studio is trying to load from this folder ? where is it getting its information from.
Also the tbb.dll is in the "C:\Program Files (x86)\MATLAB\R2014a\bin\win32" folder which I have put in the path environment variable.
How come visual studio is not looking there.
It would be very kind if someone gives my some pointer to fix the issue.
Thanks in advance.
z:\itt\... is the path where the pdb was when the dll was originally built from source, possibly on a build server or so but definitely not on your machine so it's normal you don't have that directory.
When loading symbols for a dll, the debugger will also look for the original pdb path (which is stored in the dll) apart from considering various other paths. As far as I know the PATH is not used when looking for pdbs so don't bother adding directories to it for that reason. The directory where the dll is located is searched, but you probably don't notice because it flashes by quickly in VS. (note if you want to see all places where VS searches you could use procmon).
As to why VS hangs: no idea. But does it really hang 'forever' (as in not responding + corresponding dialog)? One possibility would be that z: is mapped as a network drive and VS is waiting for a response from it, which should timeout after a while.

cannot find .exe file in Visual C++ Express 2010

So, I installed Visual C++ 2010 for the fifth time, I believe, and every time I debug a program, even the simplest c++ program fails to compile, and I get the following error:
Unable to start program 'C:\Users\Ruth\sid\game\Debug\game.exe'.
The system cannot find the file specified.
I don't know why this is happening or if I need to create an exe file. myself. I need help fast. Thanks.
Do the setup program of Visual C++ 2010 includes a repair program? If it does, then run it and try to repair your MSVC by clicking the "Repair" button therein and following the next procedure, but it takes time to complete.

How to convert MVS C++ code into executable application?

So I've made a small program in Microsoft Visual Studio C++ (2008 edition) and I want to convert it to .exe format.
I know that I can find the .exe in my project directory, however it only runs fine on my own PC. When I send it over to someone else (who doesn't have Visual Studio installed or anything), it doesn't run.
I've read a little about this and it seems to be about "linking". Now I don't know anything about linking and I'm not eager to learn in depth about it right now...
I just want to make my incredibly simple program (which edits and creates text files) to run in .exe program on any computer. Is this possible, and if so - how?
Could you please guide me through the steps? I'm quite new to programming so I really need help on this one.
Thank you in advance...
The file you sent already is an exe file, but it is most likely a debug version of the program. Also, you need to see if you are linking against other DLLs, and if you are, you should distribute those with the program as well.
Since you have a simple program, it is most likely you have no other DLL dependencies, so try compiling in release mode as a first step. There will be a dropdown at the top of VS with Debug and Release, and Debug is currently selected.
You already have the .exe file that is created by linking all the .obj files that are compiled from the .cpp files you created. To repeat myself, the linking is already happening behind the scenes. However, there are two other issues. First, you may have compiled it in debug mode. In order to run your program on another Windows machine, it is best to compile it in release mode. Also, if your program uses DLLs, such as for MFC classes, then you need to copy those DLLs to the other computer as well. In order to do this correctly, you should look at creating a setup.exe file which will correctly install your program and all the required DLLs. There are tools that can help you do this, such as InstallShield.
I think you should install runtime components of Visual C++ Libraries : "Microsoft Visual C++ 2008 Redistributable Package (x86)" required to run applications developed with Visual C++ on a computer that does not have Visual C++ 2008 installed.
http://www.microsoft.com/en-us/download/details.aspx?id=29

Can Visual Studio show me which assertion failed?

I normally work with Qt Creator for my C++ needs. When an assertion in my program fails, it can show me which assertion failed. In Visual Studio, I only see this:
I can click Retry to jump into the application, but it doesn't tell me which assertion failed. Even for a simple assert(false) Visual Studio tries to show me the source code for msvcr100d.dll, which isn't available.
How can I find out which assertion in my program failed? I really don't want to do a cumbersome manual search using a combination of breakpoints and std::couts for something that can be tracked down automatically.
Edit: Visual Studio did in fact generate a .PDB file for me, but it still isn't working. Although the debugger won't highlight the line with the failed assertion, I do see Assertion failed: false, file main.cpp, line 8 on the command line. Why can't it just show me the line and let me inspect the variables? I mean, all the information appears to be available...
All you should have to do is click "Retry" to break into the application's source code with the debugger. That will highlight the line containing the assertion that failed, so it's easy to see the culprit unless you like to cram multiple nested assertions onto a single line. And if you do, then you deserve all the pain that this might cause you.
The reason it's not working for you now is more than likely because you don't have the debugging symbols available from your application's current build. When you build an app with the compiler bundled with Visual Studio, depending on your project settings, it will generate a .PDB file, which contains the debug symbols. These are required to get useful information while debugging, such as what line produced the last failure.
Make sure that when you compile your application, you have it set to generate debug symbols. You should see a .PDB file in your /bin directory. As discussed here, the generation of debug symbols is orthogonal to whether optimizations are enabled (the configuration typically known as "Release").
Update: I just realized you're probably compiling/building the app in Qt Creator, and then trying to debug the binaries from Visual Studio. That's not going to work out well—if you don't compile using VS's tools, it's not going to generate debug symbols that the VS debugger can read.
I assume the problem would be the same in reverse: if you built with Visual Studio, then tried to debug with Qt Creator, it probably wouldn't be able to interpret the debugging symbols, either.
Therefore, I'd recommend sticking with a single toolset for building. It doesn't matter which IDE you use, but you'll need to compile/build with the same tools. You can configure either Qt Creator or Visual Studio to use the compiler and linker bundled with the other. Typically Qt Creator comes with a Win32 port of GCC, but it's trivial to get it to build with Microsoft's toolset instead, which would allow you to use VS to debug your code.