Jin
Jin

Reputation: 41

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.

Upvotes: 2

Views: 701

Answers (2)

user3800477
user3800477

Reputation: 74

In cppcheckgui, you can config your project setting in [File],then check the qt checkbox

Upvotes: 0

3CxEZiVlQ
3CxEZiVlQ

Reputation: 38862

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.

Upvotes: 7

Related Questions