I saw the union in bits/pthreads.h but I wasn't sure it was the problem.
You can't inherit from a union. Not sure how to fix this, though.
Thanks Roger! Here's what I did. I created my own fix_pthread_mutex_t from one of the structures in the union. Then I modified the code:
class RawMutex : public fix_pthread_mutex_t
{
public:
RawMutex(); // a bit too complex to inline
~RawMutex() { pthread_mutex_destroy((pthread_mutex_t*)this); }
void Lock() { pthread_mutex_lock((pthread_mutex_t*)this); }
void Unlock() { pthread_mutex_unlock((pthread_mutex_t*)this); }
bool TryLock() { return pthread_mutex_trylock((pthread_mutex_t*)this) == 0; }
};
The dnew.cpp file compiles now and I am on to the next bug:
Compiling cyclecheck.cpp
In file included from cyclecheck.cpp:17:
cyclecheck2.h: In member function ‘bool CycleChecker<T>::Search(T, T, std::list<T, std::allocator<_Tp1> >&, std::set<T, std::less<_Key>, std::allocator<_Tp1> >&, bool, bool)’:
cyclecheck2.h:90: error: expected ‘;’ before ‘i’
cyclecheck2.h:91: error: ‘i’ was not declared in this scope
cyclecheck2.h:111: error: expected ‘;’ before ‘i’
cyclecheck2.h:112: error: ‘i’ was not declared in this scope
cyclecheck2.h: In member function ‘void CycleChecker<T>::Dump()’:
cyclecheck2.h:132: error: expected ‘;’ before ‘i’
cyclecheck2.h:132: error: ‘i’ was not declared in this scope
template<typename T> bool CycleChecker<T>::Search( T start,
T searchfor,
std::list<T>& result,
std::set<T>& seen,
bool weak,
bool findstrong )
{
const set_t& children = graph[start];
seen.insert( start );
for ( set_t::const_iterator i = children.begin();
i != children.end();
++i )
{
line 90 is:
for ( set_t::const_iterator i = children.begin();
Any ideas?