一、删除引用项目的debug 二、配置管理器中把所有项目的“生成”打勾、“配置”全部选成“debug“,切忌release
三、配置管理器中“活动解决方案配置”、新建一个方案
四、将引用目录统一设到某个目录,防止没有引用到最新的(源码与dll版本不匹配)
五、工具、选项、调试、常规中的“要求源文件和原始版本完全匹配”的勾去掉
五种办法都用过了。还是没有用。
最后偶然想到,出现这个问题的原因基本上有两个:
一、要调试的dll不在调试进程的进程空间,调不到
二、源代码使用的dll与调试的源代码的版本不对,自然调试不到
用C++ vector string出现一堆warning
搜索问题和解决办法:
在include stl 之前disable掉。
#pragma warning(disable:4786)
msdn 里面说得很清楚,转换成内部名后,太长,debug下面将没办法察看(如watch):
'identifier' : identifier was truncated to 'number' characters in the debug information
自定义的结构体做map的key:
map的key要求是copyable和comparable,
typedef struct stabc
{
int a;
int b;
int c;
bool operator < (const struct stabc stABCComp )const
{
return (a!= stABCComp .a) ? (a< stABCComp .a) :
(b!= stABCComp .b) ? (b< stABCComp .b) :
(c< stABCComp .c);
}
}StABC;
inline bool operator< (const T& Left, const T& Right)
{
return
(Left.a != Right.a) ? (Left.a < Right.a) :
(Left.b != Right.b) ? (Left.b < Right.b) :
(Left.c < Right.c);
}