Hello everyone,
I’ve been trying to create a Juce Thread in an application, to try and get a better throughput. However I keep getting a Linker error. It specifically says:
"Undefined symbols for architecture x86_64:
“MainComponent::myThread::myThread(juce::String const&, unsigned long)”, referenced from:
MainComponent::MainComponent() in MainComponent.o
I’ve been trying to create a “myThread” class in MainComponent.h, which inherits from Thread.
I implement the constructor, and destructor, and override the virtual void function, “run()”.
class myThread : public Thread{
public: myThread(const String&,size_t);
void run() override{}
~myThread(){}
};
After having declared the class, and not using it anywhere, it builds okay. However, when I try and create/initialise an object anywhere in my code, e.g.
myThread clockerThreader{ “name” , 0 }
the linker error occurs. If anyone could point me in the right direction I’d be very grateful
Ahh thank you so much man, it works! You’re right, I’m going to revisit some topics. Got too excited with Juce classes that I kinda skimmed over basic c++ things that I shouldn’t have.
@giannis-xri, for future reference, to make your code more readable, please indent every line with 4 spaces, or surround the whole code with three backticks before and after, like this:
```
void your_code_here ()
{
}
```
The same is obtained by selecting the code in your post while editing, then pressing the button that has this symbol on it: </>