我有2台机器Debian 7.8 64/32位.我创建了一个简单的程序.在main.cpp中:
void action(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
static QFile logFile("logfile.log");
static QTextStream ts(&logFile);
if(logFile.open(QFile::ReadWrite | QFile::Append))
{
ts << context.file << ":" << context.line << ":"
<< context.function << ": " << msg << endl;
logFile.close();
}
}
int main(int argc, char* argv[])
{
QCoreApplication app(argc, argv);
qInstallMessageHandler(action);
qDebug() << "this is some log";
return app.exec();
}
Run Code Online (Sandbox Code Playgroud)
在"logfile.log"中我必须看到:
main.cpp:30:int main(int, char**): this is some log
Run Code Online (Sandbox Code Playgroud)
但在Debian 7.8 64位Qt 5.4.1 GCC 4.6.1 64位我只看到:
:0:: this is some log
Run Code Online (Sandbox Code Playgroud)
我还测试了Debian 7.8 32位Qt 5.3.1 GCC 4.6.1 32位.它运行良好.
这是Qt 5.4.1(64位)的错误吗?或者我错过了什么?
你能帮助我吗?
| 归档时间: |
|
| 查看次数: |
1823 次 |
| 最近记录: |