ThreadPool type error with GCC


#1

I’m trying to compile JUCE on Ubuntu linux 5.10 with gcc 4.0

I get errors with the ThreadPool class due to the order of declaration:

juce_ThreadPool.cpp ../../src/juce_core/threads/juce_ThreadPool.h:92: error: ISO C++ forbids declaration of ‘ThreadPool’ with no type ../../src/juce_core/threads/juce_ThreadPool.h:92: error: expected ‘;’ before ‘*’ token ../../src/juce_core/threads/juce_ThreadPool.cpp: In constructor ‘juce::ThreadPoolJob::ThreadPoolJob(const juce::String&)’: ../../src/juce_core/threads/juce_ThreadPool.cpp:44: error: class ‘juce::ThreadPoolJob’ does not have any field named ‘pool’ ../../src/juce_core/threads/juce_ThreadPool.cpp: In destructor ‘virtual juce::ThreadPoolJob::~ThreadPoolJob()’: ../../src/juce_core/threads/juce_ThreadPool.cpp:53: error: ‘pool’ was not declared in this scope ../../src/juce_core/threads/juce_ThreadPool.cpp: In member function ‘void juce::ThreadPool::addJob(juce::ThreadPoolJob*)’: ../../src/juce_core/threads/juce_ThreadPool.cpp:144: error: ‘class juce::ThreadPoolJob’ has no member named ‘pool’ ../../src/juce_core/threads/juce_ThreadPool.cpp:146: error: ‘class juce::ThreadPoolJob’ has no member named ‘pool’ ../../src/juce_core/threads/juce_ThreadPool.cpp:148: error: ‘class juce::ThreadPoolJob’ has no member named ‘pool’ ../../src/juce_core/threads/juce_ThreadPool.cpp: In member function ‘bool juce::ThreadPool::runNextJob()’: ../../src/juce_core/threads/juce_ThreadPool.cpp:354: error: ‘class juce::ThreadPoolJob’ has no member named ‘pool’ ../../src/juce_core/threads/juce_ThreadPool.cpp:364: error: ‘class juce::ThreadPoolJob’ has no member named ‘pool’

There’s another post on this bb with the same problem, but no solution. Anyone?


#2

Thanks for that - it’s an easy fix, which will be in the next release. It just needs some extra class declarations at the top of the file:

[code]#include “juce_Thread.h”

class ThreadPool;
class ThreadPoolThread;

[/code]


#3