Right Click your project from the project explorer.
Go to Configuration Properties->Linker->Debugging
Most probably the Value in the "Generate Debug Info" should be "No".
Set it to "Yes (/Debug)" and try debugging again.
WolfPack
Postaholic
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
Maybe the line where you set the breakpoint is not executed. Could you give us the part of the program where you set the breakpoint? The line where the breakpoint is set and 2 or 3 lines above and below it will do.
WolfPack
Postaholic
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
is record.name a std::string object? If it is, I might be wrong but I don't think you can do binary reads and writes like you are doing with that string because all that is getting read/written is the number of bytes in the class itself -- the string is not part of the class. If std::string == "Hello World", then write() will only write sizeof(std::string), not the text. For binary files, you will have to write/read a fixed-length structure that contains C character arrays.
class record
{
. ..
char name[80];
...
}
There are other more complex ways to do it that will allow you to use std::string in the class record, but the above is the simplest.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
Although setting the breakpoint at the current position looks okay, for now set the breakpoint at
maxlen = max(maxlen, record.name.size());
and see if the program stops at that point. If you already didnt know you have to press F10 to execute the code line by line. If it doesnt stop even then, there is someother problem, but I cant seem to get the cause.
WolfPack
Postaholic
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
And make sure "Solution Configurations" is set for Debug, not Release
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
Another thing, can you tell me what is in the field "Generate Program Database File" that is located right below the "Generate Debug Info" field?
WolfPack
Postaholic
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
Oh, now I understand -- reading from keyboard not a data file. It makes sense now. But should use getline(), not read. And use record.name.
while (getline(cin, record.name))
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
$(TargetDir)$(TargetName).pdb
Okay that is what is expected. Try Dragon's suggestion.
WolfPack
Postaholic
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
Where can I see that this is correct AD?
On my setup (default as installed), there is a combo box located immediately below the menu bar that lets you select either Debug or Release. Not sure how to get to it via the menus. If you have Release mode set then you will get the problems you are experiencing.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343