static 的误区

在ModelManager.h的声明了

class ModelManager{
public:
	static cnrtModel_t createModel(const std::string& model_path);
	...
};

在ModelManager.cc中,有如下实现:

static cnrtModel_t createModel(const std::string& model_path){
	...
}

报编译错误:a storage class should not specified here;
将ModelManager.cc中的static删除后,就行了。具体原因上deepseek搜了一下,感觉还是不是很懂。记录一下,以后再回头看看。

posted @ 2025-05-04 23:40  正明小佐  阅读(7)  评论(0)    收藏  举报