[HELP] Complieing Boost with vc2010

Posts 112 of 12 · Page 1 of 1
[HELP] Complieing Boost with vc2010
I've seem to have a issue complieing boost_1_45_0..

Any one have any suggestions into why this is happenning with the precomplied headers...

Code:
c:\program files\boost\boost_1_45_0\boost\thread\win32\basic_timed_mutex.hpp(149): error C2679: binary '+' : no operator found which takes a right-hand operand of type 'const bool' (or there is no acceptable conversion)
1>          C:\Program Files\Boost\boost_1_45_0\boost/date_time/posix_time/date_duration_operators.hpp(31): could be 'boost::posix_time::ptime boost::posix_time::operator +(const boost::posix_time::ptime &,const boost::gregorian::months &)' [found using argument-dependent lookup]
1>          C:\Program Files\Boost\boost_1_45_0\boost/date_time/date_duration_types.hpp(132): or       'boost::gregorian::date boost::date_time::months_duration<base_config>::operator +(const boost::gregorian::date &,const boost::date_time::months_duration<base_config> &)' [found using argument-dependent lookup]
1>          with
1>          [
1>              base_config=boost::gregorian::greg_durations_config
1>          ]
1>          C:\Program Files\Boost\boost_1_45_0\boost/date_time/posix_time/date_duration_operators.hpp(75): or       'boost::posix_time::ptime boost::posix_time::operator +(const boost::posix_time::ptime &,const boost::gregorian::years &)' [found using argument-dependent lookup]
1>          C:\Program Files\Boost\boost_1_45_0\boost/date_time/date_duration_types.hpp(244): or       'boost::gregorian::date boost::date_time::years_duration<base_config>::operator +(const boost::gregorian::date &,const boost::date_time::years_duration<base_config> &)' [found using argument-dependent lookup]
1>          with
1>          [
1>              base_config=boost::gregorian::greg_durations_config
1>          ]
1>          C:\Program Files\Boost\boost_1_45_0\boost/date_time/time.hpp(139): or       'boost::posix_time::ptime boost::date_time::base_time<T,time_system>::operator +(const boost::gregorian::date_duration &) const'
1>          with
1>          [
1>              T=boost::posix_time::ptime,
1>              time_system=boost::posix_time::posix_time_system
1>          ]
1>          C:\Program Files\Boost\boost_1_45_0\boost/date_time/time.hpp(159): or       'boost::posix_time::ptime boost::date_time::base_time<T,time_system>::operator +(const boost::posix_time::time_duration &) const'
1>          with
1>          [
1>              T=boost::posix_time::ptime,
1>              time_system=boost::posix_time::posix_time_system
1>          ]
1>          while trying to match the argument list '(boost::system_time, const bool)'
1>          C:\Program Files\Boost\boost_1_45_0\boost/thread/locks.hpp(427) : see reference to function template instantiation 'bool boost::detail::basic_timed_mutex::timed_lock<TimeDuration>(const Duration &)' being compiled
1>          with
1>          [
1>              TimeDuration=bool,
1>              Duration=bool
1>          ]
1>          C:\Program Files\Boost\boost_1_45_0\boost/thread/locks.hpp(307) : see reference to function template instantiation 'bool boost::unique_lock<Mutex>::timed_lock<TimeDuration>(const TimeDuration &)' being compiled
1>          with
1>          [
1>              Mutex=boost::mutex,
1>              TimeDuration=bool
1>          ]
1>          ..\Common\logging.cpp(7) : see reference to function template instantiation 'boost::unique_lock<Mutex>::unique_lock<bool>(Mutex &,const TimeDuration &)' being compiled
1>          with
1>          [
1>              Mutex=boost::mutex,
1>              TimeDuration=bool
1>          ]
Thankyou for your help....
what's boost? =/
Whats boost for
Quote Originally Posted by whit View Post
Whats boost for
The Boost C++ Libraries are a collection of free libraries that extend the functionality of C++.


Quote Originally Posted by whit View Post
Isn't there a precompiled library you can just link to instead of trying to compile your own?
Ya i figured it out.

Boost C++ Libraries Installers for Windows - BoostPro Computing

Best and easyier way then going thru them all and complieing them like you said.
Isn't there a precompiled library you can just link to instead of trying to compile your own?
Im pretty sure why posted the post about the precompiled library ..
either that or im stoned
Quote Originally Posted by whit View Post
Im pretty sure why posted the post about the precompiled library ..
either that or im stoned
No your not stoned. Just a fail quote from the threadstarter.
Quote Originally Posted by master131 View Post
No your not stoned. Just a fail quote from the threadstarter.
How is it a failed Quote. He explained something i researched it and post his answer.

little to much wacky tobacky master131.

If i install vc2008 and complie the old boost libs and includes my source seems to work fine but if i upgrade it to vc2010 i get that werid complie error.'

Would be nice if someone could explain why it gives this error when the libs and includes have been tested on the vc2010 complier.

(nothing wrong with my source code)

Read and write mutex is all it is.... (very hand than writing your own)
I still cant manage to complie some simple code..

Heres my source..

Code:
#include <boost/thread.hpp>
#include <boost/bind.hpp>
#include <boost/thread/condition.hpp>

class ReadWriteMutex : boost::noncopyable
{
public:
    ReadWriteMutex() :
        m_readers(0),
        m_pendingWriters(0),
        m_currentWriter(false)
    {}

    class ScopedReadLock : boost::noncopyable
    {
    public:
        ScopedReadLock(ReadWriteMutex& rwLock) :
            m_rwLock(rwLock)
        {
            m_rwLock.acquireReadLock();
        }

        ~ScopedReadLock()
        {
            m_rwLock.releaseReadLock();
        }

    private:
        ReadWriteMutex& m_rwLock;
    };

    class ScopedWriteLock : boost::noncopyable
    {
    public:
        ScopedWriteLock(ReadWriteMutex& rwLock) :
            m_rwLock(rwLock)
        {
            m_rwLock.acquireWriteLock();
        }

        ~ScopedWriteLock()
        {
            m_rwLock.releaseWriteLock();
        }

    private:
        ReadWriteMutex& m_rwLock;
    };

    void acquireReadLock()
    {
        boost::mutex::scoped_lock lock(m_mutex);

        while(m_pendingWriters != 0 || m_currentWriter)
        {
            m_writerFinished.wait(lock);
        }
        ++m_readers;
    }

    void releaseReadLock()
    {
        boost::mutex::scoped_lock lock(m_mutex);
        --m_readers;

        if(m_readers == 0)
        {
            m_noReaders.notify_all();
        }
    }

    void acquireWriteLock()
    {
        boost::mutex::scoped_lock lock(m_mutex);

        ++m_pendingWriters;
        
        while(m_readers > 0)
        {
            m_noReaders.wait(lock);
        }

        while(m_currentWriter)
        {
            m_writerFinished.wait(lock);
        }
        --m_pendingWriters;
        m_currentWriter = true;
    }

    void releaseWriteLock()
    {        
        boost::mutex::scoped_lock lock(m_mutex);
        m_currentWriter = false;
        m_writerFinished.notify_all();
    }

private:
    boost::mutex m_mutex;

    unsigned int m_readers;
    boost::condition m_noReaders;

    unsigned int m_pendingWriters;
    bool m_currentWriter;
    boost::condition m_writerFinished;
};
Still wont complie gives me the crap that i posted first....
Quote Originally Posted by faceofdevil View Post
I still cant manage to complie some simple code..

Heres my source..

Code:
#include <boost/thread.hpp>
#include <boost/bind.hpp>
#include <boost/thread/condition.hpp>

class ReadWriteMutex : boost::noncopyable
{
public:
    ReadWriteMutex() :
        m_readers(0),
        m_pendingWriters(0),
        m_currentWriter(false)
    {}

    class ScopedReadLock : boost::noncopyable
    {
    public:
        ScopedReadLock(ReadWriteMutex& rwLock) :
            m_rwLock(rwLock)
        {
            m_rwLock.acquireReadLock();
        }

        ~ScopedReadLock()
        {
            m_rwLock.releaseReadLock();
        }

    private:
        ReadWriteMutex& m_rwLock;
    };

    class ScopedWriteLock : boost::noncopyable
    {
    public:
        ScopedWriteLock(ReadWriteMutex& rwLock) :
            m_rwLock(rwLock)
        {
            m_rwLock.acquireWriteLock();
        }

        ~ScopedWriteLock()
        {
            m_rwLock.releaseWriteLock();
        }

    private:
        ReadWriteMutex& m_rwLock;
    };

    void acquireReadLock()
    {
        boost::mutex::scoped_lock lock(m_mutex);

        while(m_pendingWriters != 0 || m_currentWriter)
        {
            m_writerFinished.wait(lock);
        }
        ++m_readers;
    }

    void releaseReadLock()
    {
        boost::mutex::scoped_lock lock(m_mutex);
        --m_readers;

        if(m_readers == 0)
        {
            m_noReaders.notify_all();
        }
    }

    void acquireWriteLock()
    {
        boost::mutex::scoped_lock lock(m_mutex);

        ++m_pendingWriters;
        
        while(m_readers > 0)
        {
            m_noReaders.wait(lock);
        }

        while(m_currentWriter)
        {
            m_writerFinished.wait(lock);
        }
        --m_pendingWriters;
        m_currentWriter = true;
    }

    void releaseWriteLock()
    {        
        boost::mutex::scoped_lock lock(m_mutex);
        m_currentWriter = false;
        m_writerFinished.notify_all();
    }

private:
    boost::mutex m_mutex;

    unsigned int m_readers;
    boost::condition m_noReaders;

    unsigned int m_pendingWriters;
    bool m_currentWriter;
    boost::condition m_writerFinished;
};
Still wont complie gives me the crap that i posted first....
how about not compiling with vc2010, it sucks balls, if you only like the IDE just set the environment path to an older version. As a side note: I've never managed to use boost successfully, and looking back I'm glad I didn't because you learn much more if you do it all by yourself
Posts 112 of 12 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Need help?