|
Boost Users : |
From: Michael Hunley (mhunley_at_[hidden])
Date: 2003-03-04 13:10:52
Disclaimer: I am relatively new to gcc, linux and Boost. I'm hoping
someone out in the group who is much more knowledgable about all of them
can help me get past a hurdle in code I am porting from Windows. I am
getting a vague error message from g++ (gcc 3.2-7 under Redhat Linux 8.0)
in my code using the Boost scoped_lock.
I have wrapped the Boost versions of mutex and mutex::scoped_lock as:
class PMutex
{
public:
PMutex() {}
virtual ~PMutex() {}
protected:
boost::mutex m_Mutex;
friend class PScopedLock;
};
class PScopedLock
{
public:
explicit PScopedLock( PMutex& M ) : m_ScopedLock(M.m_Mutex) {}
virtual ~PScopedLock() {}
static PScopedLock* Create( PMutex& M ) { return
(PScopedLock*) ::new PScopedLock(M); }
void Destroy( void ) { delete this; }
protected:
void* operator new(size_t) {} // disallowed, must declare on the
stack
boost::mutex::scoped_lock m_ScopedLock;
friend class PCondition;
};
The error is "ISO C++ forbids declarations of 'type name' with no type". I
get that error on several lines, but most notably on a simple declaration like:
PScopedLock Lock(MyMutex);
From what little I can find on the newsgroups, this sort of error has been
noted when use of template template parameters are not declared quite
correctly (without the trailing ::template from what I can gather). But as
far as I can tell, I should not be having that issue. I am not
knowledgeable enough about templates, Boost or gcc/g++ to sort out what I
am running into. Boost builds fine under gcc, the code I am porting
compiles fine under MSVC6 and Kylix3, but not gcc. Can anyone help me out?
thanks.
michael
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net