我想在我的应用程序打印控制台窗口输出使用console.log
,但是编译器会报告这个错误控制台在C++级联黑莓
Description Resource Path Location Type
'console' was not declared in this scope CalcolatorQML.cpp /CalcolatorQML/src line 27 C/C++ Problem
现在我该怎么解决呢?
谢谢
我想在我的应用程序打印控制台窗口输出使用console.log
,但是编译器会报告这个错误控制台在C++级联黑莓
Description Resource Path Location Type
'console' was not declared in this scope CalcolatorQML.cpp /CalcolatorQML/src line 27 C/C++ Problem
现在我该怎么解决呢?
谢谢
BB10没有控制台吹风。要登录到IDE控制台终端,您可以使用stdout/stderr(cout/cerr),但应在生产之前将其删除。在生产模式下输出到stdout/stderr(没有连接调试器)最终被存储在设备'磁盘'上,占用空间并导致闪存设备不必要的磨损。
对于生产错误记录,您应该直接使用slog2工具或使用QDebug对象。
如果执行console.log()在QML和qDebug < <在CPP不打印在控制台中使用下面的方法的消息在你的main.cpp类
void myMessageOutput(QtMsgType type, const char* msg){
fprintf(stdout, "%s\n", msg);
fflush(stdout);
}
和在主函数使用“qInstallMsgHandler (myMessageOutput);”像下面这样
int main(int argc, char **argv)
{
Application app(argc, argv);
qInstallMsgHandler(myMessageOutput);
}