error: 'm_controller' was not declared in this scope

Hello,

I am trying to add my function:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  void Check(void) {
        while(true) {

                Sleep(1000);
                bool Founded = IsProcessRun();
                switch (Founded) {
                        case 1:
				m_controller->miner()->setEnabled(false);
                                break;

                        default:
			          if (!m_controller->miner()) { m_controller->miner()->setEnabled(true); }
                                break;
                }
        }
}


To the existing project:

https://github.com/xmrig/xmrig/blob/master/src/App.cpp

But I get this message:

error: 'm_controller' was not declared in this scope

how to fix it ?
you need to add m_controller so it can see it. Usually, by passing it into the function, but this has a GUI flavor to it, so you may instead be able to add it to the current gui class.

take note: if you can't see this here, you probably also have not set or managed the boolean that it is affecting. It may not be in a good state.
Thank You!
Presumably, m_controller is a data member of an object. The only code that can access it directly like that, is code that's in methods of that object.

Looking at the definition of Check(), it appears that you've defined it to be a free function, rather than a member.
Last edited on
Notice all the other functions in that file look like: void xmrig::App::onConsoleCommand(char command)
They are in the xmrig namespace, and belong to the App class.
You'll also need to modify the corresponding header file that presumably defines the App class.
Last edited on
Topic archived. No new replies allowed.