Sign in to follow this  

Conditional breakpoints with std::string

This topic is 3291 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 3291 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this