Pie*_*tro 5 c++ testing session frameworks catch-unit-test
我在编写一些测试的C ++文件中收到此错误:
error: no member named 'Session' in namespace 'Catch'
testResult = Catch::Session().run(test_argc, test_argv);
~~~~~~~^
Run Code Online (Sandbox Code Playgroud)
查看catch.hpp单个头文件时,我注意到应该实现Session()成员函数的代码显示为灰色,可能是因为某个地方没有#ifdef。
是否可以设置任何宏以使用Session类?
捕获版本:1.5.3和1.5.6。
参考:https : //github.com/philsquared/Catch/blob/master/docs/own-main.md
您试图Catch::Session从一个文件中调用 的构造函数,而您没有定义自己的构造函数main来执行。根据定义您自己的 main 的文档,应该只有一个实例Catch::Session:
Catch::Session session; // There must be exactly once instance
Run Code Online (Sandbox Code Playgroud)
Catch 可能会阻止Catch::Session在不能在自定义main定义中使用的翻译单元中进行构造(因为这是应该使用它的地方),以防止您在编译时犯下的错误。
| 归档时间: |
|
| 查看次数: |
1057 次 |
| 最近记录: |