这是我多年来不时尝试的东西,但从未完全成功。我只想基于字符串相等为Visual C++ 2012设置一个条件断点。我想测试的变量是
string test;
我试过了
test == "foo"
=> The breakpoint cannot be set. no operator "==" matches these operands
test == string("foo")
=> The breakpoint cannot be set. no operator "==" matches these operands
test.compare("foo") == 0
=> The breakpoint cannot be set. This expression has side effects and will not be evaluated.
strcmp(test.c_str(), "foo") == 0
=> The breakpoint cannot be set. This expression has side effects and will not be evaluated.
发布于 2014-02-21 21:43:24
您可以使用以下可移植且简单的方法:
if (!test.compare("foo")) {
int dummy = 0; // any statement, put breakpoint here
}
https://stackoverflow.com/questions/21935563
复制相似问题