Skip to main content
gamedev.net
🔒 Locked

Conditional breakpoints with std::string

Started by Mizipzor 3 replies 3.5k views
Original Post
Mizipzor
Mizipzor
Im trying to see why a file cant be loaded, but the others can so now Im trying to setup a conditional breakpoint. This is with Visual Studio 2005, Ive set a breakpoint and in breakpoints window (alt+f9) I rightclick and set condition to: path=="levels/test.xml" But when starting the program I get this message:
Quote:
The following breakpoint cannot be set: At file.cc, line 71 ('File( std::string path )', line 4), when 'path=="levels/test.xml"' is true Unable to evaluate the breakpoint condition: CXX0058: Error: overloaded operator not found
Which seems strange, std::string has that operator. What am I doing wrong?
Scourage
Scourage
please post your code. It's difficult to troubleshoot what is going on with just that.

cheers,

Bob

[size="3"]Halfway down the trail to Hell...
Adam_42
Adam_42
The simplest solution is to modify the code. If you want to break every time use:

if (path=="levels/test.xml")
DebugBreak();

If not replace the call with some other statement you can put a breakpoint on.

I've found that the debugger isn't always very good at evaluating operators, or reporting useful errors when you get the syntax slightly wrong.
nhatkthanh
nhatkthanh
You can do this,

bool b = path=="levels/test.xml";

then set the conditional break point when b is true (you might just need to enter b, if there's a radio button that selected "Is true" already there).
Mizipzor
Mizipzor
Yes, adding some code to do the same thing is of course the easiest way to go. I was just wondering if this could be done without a recompile. :)

Quote:
Original post by Scourage
please post your code. It's difficult to troubleshoot what is going on with just that.


Actually, this hasnt anything to do with my code.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.