我需要在 for 循环的每个语句中打印一些内容。因为我的程序在 for 循环中崩溃了。所以我尝试在 for 循环中添加跟踪语句,
for ( ICollection::const_iterator iter = pCol->begin(NULL),OutputDebugString(L"One"); iter != pCol->end(NULL); ++iter)
{ //see OutputDebugString
我收到以下错误,
错误 1 错误 C2664: 'IIteratable::ConstIterator::ConstIterator(std::auto_ptr<_Ty>)' : 无法将参数 1 从 'const wchar_t [4]' 转换为 'std::auto_ptr<_Ty>' filename.cpp 629
现在我在示例应用程序中尝试了同样的事情,它工作正常,
void justPrint(std::string s)
{
cout<<"Just print";
}
int main()
{
int i;
for(i = 0,justPrint("a"); i<3; i++)
{
}
return 0;
}
OutputDebugString 和 justPrint 都返回 void,我在代码中做错了什么。