Boost logo

Boost Users :

Subject: Re: [Boost-users] [ptr_container] ptr_map and MinGW: "a declaration of assert must be available", even with cassert included
From: philipp_muenzel_at_[hidden]
Date: 2009-06-18 04:29:42


Hi,

the error originates from various headers that ptr_map includes.
This is the whole output from gcc, perhaps it helps:

g++ -c -g -Wall -fno-exceptions -fno-rtti -I"c:\boost_1_39_0" -
I"." -o release\datacontainer.o datacontainer.
cpp
In file included from c:/boost_1_39_0/boost/scoped_array.hpp:14,
                 from c:/boost_1_39_0/boost/ptr_container/detail/scoped_deleter.
hpp:21,
                 from c:/boost_1_39_0/boost/ptr_container/detail/reversible_ptr_
container.hpp:21,
                 from c:/boost_1_39_0/boost/ptr_container/detail/associative_ptr
_container.hpp:20,
                 from c:/boost_1_39_0/boost/ptr_container/ptr_map_adapter.hpp:20
,
                 from c:/boost_1_39_0/boost/ptr_container/ptr_map.hpp:20,
                 from datacontainer.h:29,
                 from datacontainer.cpp:21:
c:/boost_1_39_0/boost/smart_ptr/scoped_array.hpp: In member function `T& boost::
scoped_array<T>::operator[](ptrdiff_t) const':
c:/boost_1_39_0/boost/smart_ptr/scoped_array.hpp:80: error: there are no argumen
ts to `assert' that depend on a template parameter, so a declaration of `assert'
 must be available
c:/boost_1_39_0/boost/smart_ptr/scoped_array.hpp:80: error: (if you use `-fpermi
ssive', G++ will accept your code, but allowing the use of an undeclared name is
 deprecated)
In file included from c:/boost_1_39_0/boost/ptr_container/detail/reversible_ptr_
container.hpp:21,
                 from c:/boost_1_39_0/boost/ptr_container/detail/associative_ptr
_container.hpp:20,
                 from c:/boost_1_39_0/boost/ptr_container/ptr_map_adapter.hpp:20
,
                 from c:/boost_1_39_0/boost/ptr_container/ptr_map.hpp:20,
                 from datacontainer.h:29,
                 from datacontainer.cpp:21:
c:/boost_1_39_0/boost/ptr_container/detail/scoped_deleter.hpp: In constructor `b
oost::ptr_container_detail::scoped_deleter<T, CloneAllocator>::scoped_deleter(si
ze_t)':
c:/boost_1_39_0/boost/ptr_container/detail/scoped_deleter.hpp:47: error: there a
re no arguments to `assert' that depend on a template parameter, so a declaratio
n of `assert' must be available
c:/boost_1_39_0/boost/ptr_container/detail/scoped_deleter.hpp: In constructor `b
oost::ptr_container_detail::scoped_deleter<T, CloneAllocator>::scoped_deleter(si
ze_t, const T&)':
c:/boost_1_39_0/boost/ptr_container/detail/scoped_deleter.hpp:58: error: there a
re no arguments to `assert' that depend on a template parameter, so a declaratio
n of `assert' must be available
c:/boost_1_39_0/boost/ptr_container/detail/scoped_deleter.hpp: In constructor `b
oost::ptr_container_detail::scoped_deleter<T, CloneAllocator>::scoped_deleter(In
putIterator, InputIterator)':
c:/boost_1_39_0/boost/ptr_container/detail/scoped_deleter.hpp:71: error: there a
re no arguments to `assert' that depend on a template parameter, so a declaratio
n of `assert' must be available
In file included from c:/boost_1_39_0/boost/ptr_container/detail/reversible_ptr_
container.hpp:24,
                 from c:/boost_1_39_0/boost/ptr_container/detail/associative_ptr
_container.hpp:20,
                 from c:/boost_1_39_0/boost/ptr_container/ptr_map_adapter.hpp:20
,
                 from c:/boost_1_39_0/boost/ptr_container/ptr_map.hpp:20,
                 from datacontainer.h:29,
                 from datacontainer.cpp:21:
c:/boost_1_39_0/boost/ptr_container/clone_allocator.hpp: In function `T* boost::
new_clone(const T&)':
c:/boost_1_39_0/boost/ptr_container/clone_allocator.hpp:35: error: cannot use ty
peid with -fno-rtti
c:/boost_1_39_0/boost/ptr_container/clone_allocator.hpp:35: error: cannot use ty
peid with -fno-rtti
c:/boost_1_39_0/boost/ptr_container/clone_allocator.hpp:35: error: there are no
arguments to `assert' that depend on a template parameter, so a declaration of `
assert' must be available
In file included from c:/boost_1_39_0/boost/ptr_container/detail/associative_ptr
_container.hpp:20,
                 from c:/boost_1_39_0/boost/ptr_container/ptr_map_adapter.hpp:20
,
                 from c:/boost_1_39_0/boost/ptr_container/ptr_map.hpp:20,
                 from datacontainer.h:29,
                 from datacontainer.cpp:21:
c:/boost_1_39_0/boost/ptr_container/detail/reversible_ptr_container.hpp: In stat
ic member function `static typename Config::value_type* boost::ptr_container_det
ail::reversible_ptr_container<Config, CloneAllocator>::null_clone_allocator<allo
w_null_values>::allocate_clone(const typename Config::value_type*)':
c:/boost_1_39_0/boost/ptr_container/detail/reversible_ptr_container.hpp:111: err
or: cannot use typeid with -fno-rtti
c:/boost_1_39_0/boost/ptr_container/detail/reversible_ptr_container.hpp:111: err
or: cannot use typeid with -fno-rtti
c:/boost_1_39_0/boost/ptr_container/detail/reversible_ptr_container.hpp:111: err
or: there are no arguments to `assert' that depend on a template parameter, so a
 declaration of `assert' must be available
In file included from c:/boost_1_39_0/boost/ptr_container/ptr_map_adapter.hpp:20
,
                 from c:/boost_1_39_0/boost/ptr_container/ptr_map.hpp:20,
                 from datacontainer.h:29,
                 from datacontainer.cpp:21:
c:/boost_1_39_0/boost/ptr_container/detail/associative_ptr_container.hpp: In mem
ber function `void boost::ptr_container_detail::associative_ptr_container<Config
, CloneAllocator>::multi_transfer(typename AssociatePtrCont::iterator, Associate
PtrCont&)':
c:/boost_1_39_0/boost/ptr_container/detail/associative_ptr_container.hpp:196: er
ror: there are no arguments to `assert' that depend on a template parameter, so
a declaration of `assert' must be available
c:/boost_1_39_0/boost/ptr_container/detail/associative_ptr_container.hpp: In mem
ber function `typename boost::ptr_container_detail::reversible_ptr_container<Con
fig, CloneAllocator>::size_type boost::ptr_container_detail::associative_ptr_con
tainer<Config, CloneAllocator>::multi_transfer(typename AssociatePtrCont::iterat
or, typename AssociatePtrCont::iterator, AssociatePtrCont&)':
c:/boost_1_39_0/boost/ptr_container/detail/associative_ptr_container.hpp:208: er
ror: there are no arguments to `assert' that depend on a template parameter, so
a declaration of `assert' must be available
c:/boost_1_39_0/boost/ptr_container/detail/associative_ptr_container.hpp: In mem
ber function `bool boost::ptr_container_detail::associative_ptr_container<Config
, CloneAllocator>::single_transfer(typename AssociatePtrCont::iterator, Associat
ePtrCont&)':
c:/boost_1_39_0/boost/ptr_container/detail/associative_ptr_container.hpp:229: er
ror: there are no arguments to `assert' that depend on a template parameter, so
a declaration of `assert' must be available
c:/boost_1_39_0/boost/ptr_container/detail/associative_ptr_container.hpp: In mem
ber function `typename boost::ptr_container_detail::reversible_ptr_container<Con
fig, CloneAllocator>::size_type boost::ptr_container_detail::associative_ptr_con
tainer<Config, CloneAllocator>::single_transfer(typename AssociatePtrCont::itera
tor, typename AssociatePtrCont::iterator, AssociatePtrCont&)':
c:/boost_1_39_0/boost/ptr_container/detail/associative_ptr_container.hpp:245: er
ror: there are no arguments to `assert' that depend on a template parameter, so
a declaration of `assert' must be available
In file included from c:/boost_1_39_0/boost/ptr_container/ptr_map.hpp:20,
                 from datacontainer.h:29,
                 from datacontainer.cpp:21:
c:/boost_1_39_0/boost/ptr_container/ptr_map_adapter.hpp: In member function `typ
ename boost::ptr_container_detail::associative_ptr_container<boost::ptr_containe
r_detail::map_config<T, VoidPtrMap, Ordered>, CloneAllocator>::const_reference b
oost::ptr_container_detail::ptr_map_adapter_base<T, VoidPtrMap, CloneAllocator,
Ordered>::lookup(const typename boost::ptr_container_detail::associative_ptr_con
tainer<boost::ptr_container_detail::map_config<T, VoidPtrMap, Ordered>, CloneAll
ocator>::key_type&) const':
c:/boost_1_39_0/boost/ptr_container/ptr_map_adapter.hpp:176: error: there are no
 arguments to `assert' that depend on a template parameter, so a declaration of
`assert' must be available
datacontainer.cpp: In member function `bool DataContainer::addRequestedData(uint
32_t, const std::string&)':
datacontainer.cpp:91: warning: comparison between signed and unsigned integer ex
pressions
c:/boost_1_39_0/boost/ptr_container/detail/reversible_ptr_container.hpp: In stat
ic member function `static void boost::ptr_container_detail::reversible_ptr_cont
ainer<Config, CloneAllocator>::enforce_null_policy(const typename Config::value_
type*, const char*) [with Config = boost::ptr_container_detail::map_config<ICanD
ataToSend, std::map<uint32_t, void*, std::less<uint32_t>, std::allocator<std::pa
ir<const uint32_t, void*> > >, true>, CloneAllocator = boost::heap_clone_alloca
tor]':
c:/boost_1_39_0/boost/ptr_container/ptr_map_adapter.hpp:524: instantiated from
 `std::pair<typename boost::ptr_container_detail::ptr_map_adapter_base<T, VoidPt
rMap, CloneAllocator, Ordered>::iterator, bool> boost::ptr_map_adapter<T, VoidPt
rMap, CloneAllocator, Ordered>::insert_impl(const typename boost::ptr_container_
detail::ptr_map_adapter_base<T, VoidPtrMap, CloneAllocator, Ordered>::key_type&,
 typename boost::ptr_container_detail::ptr_map_adapter_base<T, VoidPtrMap, Clone
Allocator, Ordered>::mapped_type) [with T = ICanDataToSend, VoidPtrMap = std::ma
p<uint32_t, void*, std::less<uint32_t>, std::allocator<std::pair<const uint32_t,
 void*> > >, CloneAllocator = boost::heap_clone_allocator, bool Ordered = true]
'
c:/boost_1_39_0/boost/ptr_container/ptr_map_adapter.hpp:550: instantiated from
 `std::pair<typename boost::ptr_container_detail::ptr_map_adapter_base<T, VoidPt
rMap, CloneAllocator, Ordered>::iterator, bool> boost::ptr_map_adapter<T, VoidPt
rMap, CloneAllocator, Ordered>::insert(typename boost::ptr_container_detail::ptr
_map_adapter_base<T, VoidPtrMap, CloneAllocator, Ordered>::key_type&, typename b
oost::ptr_container_detail::ptr_map_adapter_base<T, VoidPtrMap, CloneAllocator,
Ordered>::mapped_type) [with T = ICanDataToSend, VoidPtrMap = std::map<uint32_t,
 void*, std::less<uint32_t>, std::allocator<std::pair<const uint32_t, void*> > >
, CloneAllocator = boost::heap_clone_allocator, bool Ordered = true]'
datacontainer.cpp:124: instantiated from here
c:/boost_1_39_0/boost/ptr_container/detail/reversible_ptr_container.hpp:264: err
or: `assert' was not declared in this scope
c:/boost_1_39_0/boost/ptr_container/detail/reversible_ptr_container.hpp:264: war
ning: unused variable 'assert'
mingw32-make[1]: *** [release/datacontainer.o] Error 1

> -----Ursprüngliche Nachricht-----
> philipp_muenzel_at_[hidden] skrev:
> > Hello,
> >
> > I'm using boost::ptr_map successfully on Linux, compiling with gcc 4.3.2.
> > However, now i tried the same code on Windows XP, using MinGW with gcc 3.4.5 i get the following error:
> > "error: there are no arguments to 'assert' that depend on a template parameter, so a declaration of 'assert' must be available".
> >
> > I had exactly the same error on Linux, there i put a #include <cassert> before the #include to boost::ptr_map and everything worked.
> > But on windows, i tried #include <cassert> and #include <assert.h>, also a
> > #include <cassert>
> > #ifndef assert
> > #define assert assert
> > #endif
> > in case something was messing with the name.
> > I tried version 1.39 and 1.37 on windows and the result is the same.
> >
> > I also carefully inspected the headers i also include, suspecting some might #define an include-guard that confuses with assert.
> >
> > No luck yet and I'm out of ideas now.
> >
> > Any ideas are greatly appreciated.
>
> Hm. I have no idea, actually. I tried to grep for assert in the source
> without any luck :-(
>
> Are the ptr container headers the only headers that you include?
>
> -Thorsten
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
___________________________________________________________________
WEB.DE FreeDSL Komplettanschluss mit DSL 6.000 Flatrate und
Telefonanschluss für 17,95 Euro/mtl.! http://produkte.web.de/go/02/


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