Boost logo

Boost Users :

From: Ben Hutchings (ben.hutchings_at_[hidden])
Date: 2004-08-02 08:07:24


Dr Jekyll <drjekyll_at_[hidden]> wrote:
> Hi,
> I use a library, which itself use Boost. This library define
>
> #define Handle boost::shared_ptr

Ugh.

> But because I intende to use WINAPI , this definition results
> in a conflict
>
> c:\Program Files\Microsoft Visual Studio .NET
> 2003\Vc7\PlatformSDK\Include\WinUser.h(3282): error C2751:
> 'boost::shared_ptr' : the name of a function parameter cannot
> be qualified
<snip>
> What should I do, if I have to keep the #define line in my library...

Don't use that library. Its code quality is so low that you will
probably waste more time working around its bugs then you can
save by using it.

If you disagree with this assessment, perhaps you could write and
use a wrapper header that does something like:

    #ifndef LIBRARY_WRAPPER_H
    #define LIBRARY_WRAPPER_H

    #include "library.h"
    #undef Handle
    // undefine any other unwanted macros

    #endif // !defined(LIBRARY_WRAPPER_H)


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