【问题标题】:Axter EzLogger - How to remove warning or error messages? i686-apple-darwin10-g++-4.2.1 (GCC) 4.2.1Axter EzLogger - 如何删除警告或错误消息? i686-apple-darwin10-g++-4.2.1 (GCC) 4.2.1
【发布时间】:2012-06-05 04:12:11
【问题描述】:

我正在使用http://axter.com/ezlogger/index.htm提供的 EzLogger

我尝试从该网站编译简单的示例代码来测试 C++ 记录器。我有一些错误,我发现我可以使用 -fpermissive gcc 选项编译它。现在,我收到这样的警告消息:

In file included from src/ezlogger_headers.hpp:18,
src/ezlogger.hpp: In static member function ‘static void axter::ezlogger<EZLOGGER_OUTPUT_POLICY, EZLOGGER_FORMAT_POLICY, EZLOGGER_VERBOSITY_LEVEL_POLICY>::log_out(const char*, int, const char*, axter::ext_data, bool, const T&)’:
src/ezlogger.hpp:248: warning: there are no arguments to ‘get_log_stream’ that depend on a template parameter, so a declaration of ‘get_log_stream’ must be available
src/ezlogger.hpp:248: warning: there are no arguments to ‘get_log_prefix_format’ that depend on a template parameter, so a declaration of ‘get_log_prefix_format’ must be available
src/ezlogger.hpp:249: warning: there are no arguments to ‘get_log_stream’ that depend on a template parameter, so a declaration of ‘get_log_stream’ must be available
src/ezlogger.hpp: In static member function ‘static void axter::ezlogger<EZLOGGER_OUTPUT_POLICY, EZLOGGER_FORMAT_POLICY, EZLOGGER_VERBOSITY_LEVEL_POLICY>::log_out(const char*, int, const char*, axter::ext_data, bool, const T1&, const T2&)’:
src/ezlogger.hpp:255: warning: there are no arguments to ‘get_log_stream’ that depend on a template parameter, so a declaration of ‘get_log_stream’ must be available
src/ezlogger.hpp:255: warning: there are no arguments to ‘get_log_prefix_format’ that depend on a template parameter, so a declaration of ‘get_log_prefix_format’ must be available
src/ezlogger.hpp:256: warning: there are no arguments to ‘get_log_stream’ that depend on a template parameter, so a declaration of ‘get_log_stream’ must be available
src/ezlogger.hpp: In static member function ‘static void axter::ezlogger<EZLOGGER_OUTPUT_POLICY, EZLOGGER_FORMAT_POLICY, EZLOGGER_VERBOSITY_LEVEL_POLICY>::log_out(const char*, int, const char*, axter::ext_data, bool, const T1&, const T2&, const T3&)’:
src/ezlogger.hpp:262: warning: there are no arguments to ‘get_log_stream’ that depend on a template parameter, so a declaration of ‘get_log_stream’ must be available
src/ezlogger.hpp:262: warning: there are no arguments to ‘get_log_prefix_format’ that depend on a template parameter, so a declaration of ‘get_log_prefix_format’ must be available
src/ezlogger.hpp:263: warning: there are no arguments to ‘get_log_stream’ that depend on a template parameter, so a declaration of ‘get_log_stream’ must be available

有没有办法删除警告信息?

【问题讨论】:

    标签: c++ templates logging gcc


    【解决方案1】:

    我不确定我是否找到了自己问题的答案。

    首先,我注意到post,它暗示了在较新版本的 C++ 标准中可以更正的内容。当使用多个带有“模板”的基类时,方法“应该”明确指定该方法属于哪个基类。在帖子中,将使用保留字“this”。在我的例子中,函数是静态的,我必须在函数前面加上 get_log_stream,前面带有双冒号的类名。

    【讨论】:

    • 这是一个很好的解决方案。您可以接受您的回答(勾选,在投票箭头下方)将此问题标记为已解决。
    猜你喜欢
    • 2012-07-27
    • 2010-09-18
    • 2021-01-16
    • 2011-10-14
    • 2010-10-29
    • 2020-09-26
    • 1970-01-01
    • 2016-01-25
    • 2015-06-28
    相关资源
    最近更新 更多