Search code examples
c++qtstatic-analysiscppcheck

Problem estimating Qt Slot as Error in Cppcheck Analysis


While performing static analysis with Cppcheck, the corresponding error message was printed in the slots part, but I don't know how to solve this part. Can you help me?

err_msg : There is an unknown macro here somewhere. Configuration is required. If slots is a macro then please configure it.

#ifndef A_H
#define A_H

#include "BasePopup.hpp"

namespace Ui {
class A;
}

class A: public BasePopup
{
    Q_OBJECT

public:
    A();
    ~A();
    ...
protected:
    ...

private:
    ...

signals:
    ...

private slots: // err_msg
    ...
};

#endif // A_H

Compilation and build work well without any problems, but only considered errors in Cppcheck static analysis.

  • For your information, I'm working on "visual studio code".

Solution

  • If you run cppcheck command line tool, run it with the command line parameter

    --library=qt
    

    If you run cppcheck in Qt Creator, no extra actions are needed.