Constructor for 'Model' must explicitly initialize the member 'shader' which does not have a default constructor
时间: 2023-12-23 14:05:18 浏览: 44
The error message you are encountering suggests that there is a member variable called 'shader' in the 'Model' class that does not have a default constructor, and it needs to be explicitly initialized in the constructor of the 'Model' class.
To resolve this issue, you should add an explicit initialization for the 'shader' member variable in the constructor of the 'Model' class. You can do this by using an initializer list.
For example:
```cpp
class Model {
private:
Shader shader; // Assuming 'Shader' is the type of the 'shader' member variable
public:
Model() : shader(/* arguments for shader's constructor */) {
// Constructor code
}
};
```
Replace `Shader` with the actual type of the 'shader' member variable, and provide the necessary arguments for the 'shader' constructor within the initializer list.
By explicitly initializing the 'shader' member variable in the constructor, you ensure that it is properly initialized before any other code in the constructor executes.
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)