如何初始化和使用静态结构

Kol*_*iya 2 c++ opencv

我在一个类中定义了一个静态结构。但它导致错误为错误

错误 LNK1120:1 个未解析的外部

我的头文件

class CornerCapturer{
    static struct configValues
    {
        int block;
        int k_size;
        int thre;
        double k;
        configValues() :block(2), k_size(3), thre(200), k(0.04){}
    }configuration;
public:
    void captureCorners(Mat frame);
}
Run Code Online (Sandbox Code Playgroud)

我的cpp文件

void CornerCapturer::captureCorners(Mat frame){

    int y= CornerCapturer::configuration.thre;
}
Run Code Online (Sandbox Code Playgroud)

请帮我

A.S*_*S.H 5

将此添加到您的 cpp 文件中;以实例的静态结构:

CornerCapturer::configValues CornerCapturer::configuration;
Run Code Online (Sandbox Code Playgroud)

并且不要忘记在您的课程;结束后}