C++ ASSERT-C+;的编译器错误+; #包括“stdafx.h” #包括 #包括 使用名称空间std; 甲级 { 公众: int IsLocked(); }; int A::IsLocked() { 返回false; } int main() { A a1; 断言(a1.IsLocked()); 返回0; }
找不到将错误获取为断言标识符。。。。我也试过包括..应该是:C++ ASSERT-C+;的编译器错误+; #包括“stdafx.h” #包括 #包括 使用名称空间std; 甲级 { 公众: int IsLocked(); }; int A::IsLocked() { 返回false; } int main() { A a1; 断言(a1.IsLocked()); 返回0; },c++,compiler-errors,C++,Compiler Errors,找不到将错误获取为断言标识符。。。。我也试过包括..应该是: #include "stdafx.h" #include <iostream> #include <assert.h> using namespace std; class A { public: int IsLocked(); }; int A::IsLocked() { return false; } int main() { A a1; ASSERT(a1.IsLoc
#include "stdafx.h"
#include <iostream>
#include <assert.h>
using namespace std;
class A
{
public:
int IsLocked();
};
int A::IsLocked()
{
return false;
}
int main()
{
A a1;
ASSERT(a1.IsLocked());
return 0;
}
注意小写。应为:
#include "stdafx.h"
#include <iostream>
#include <assert.h>
using namespace std;
class A
{
public:
int IsLocked();
};
int A::IsLocked()
{
return false;
}
int main()
{
A a1;
ASSERT(a1.IsLocked());
return 0;
}
注意小写。此外,由于a1.IsLocked()将返回false,因此评估将失败。这可能是故意的,但我想我应该提到它。此外,由于a1.IsLocked()将返回false,因此断言将失败。这可能是故意的,但我想我应该提一下。