GPT答: |
7i24.cn
|
The error message is indicating that you are trying to access a non-static data member `transtream` from the class `grabImage` in a static context.
To fix this error, you have two options:
1. Make the `transtream` member variable static:
- In your `grabImage.h` file, change the declaration of `transtream` to:
```cpp
static bool transtream;
```
- In your `grabImage.cpp` file, add the definition of `transtream`, outside of any function:
```cpp
bool grabImage::transtream = false;
```
2. Create an instance of the class and access its member variable through that instance:
- In your main function, create an instance of the `grabImage` class:
```cpp
grabImage image;
```
- Change your if statement to use the instance's member variable instead:
```cpp
if (image.transtream == false) {
```
Choose one option based on how you intend to use the `transtream` variable in your program.
|