error: 'comp' was not declared in this scope

Divy Kanungo divyk@bgnet.bgsu.edu
Wed Feb 14 19:59:00 GMT 2007


Hi Eljay,

Thanks for reply. Using your proposed solution solved the 
problem of c and comp not being declared in scope. So, is it 
that the new gcc version does not allow directly using the 
protected variabled declared in parent class? (because that 
worked fine when I had gcc 3.4.3)

Also now I have new issues when I compile the program. I get the 
following linker errors:

/usr/local/lib/libbg.so: undefined reference to 
`std::__default_alloc_template<true, 0>::allocate(unsigned int)'
/usr/local/lib/libbg.so: undefined reference to 
`std::basic_streambuf<char, std::char_traits<char> 
>::_M_out_cur_move(long)'
/usr/local/lib/libbg.so: undefined reference to 
`std::basic_string<char, std::char_traits<char>, 
std::allocator<char> >::_Rep::_S_create(unsigned int, 
std::allocator<char> const&)'
/usr/local/lib/libbg.so: undefined reference to 
`std::basic_string<char, std::char_traits<char>, 
std::allocator<char> >::_S_empty_rep_storage'
/usr/local/lib/libbg.so: undefined reference to 
`std::__default_alloc_template<true, 0>::deallocate(void*, 
unsigned int)'
collect2: ld returned 1 exit status

I am not sure why these are appearing. How can solve the above 
problems.

Divy. 

---------Included Message----------
>Date: 14-Feb-2007 07:23:38 -0500
>From: "John Love-Jensen" <eljay@adobe.com>
>To: "Divy Kanungo" <divyk@bgnet.bgsu.edu>, "MSX to GCC" <gcc-
help@gcc.gnu.org>
>Subject: Re: error: 'comp' was not declared in this scope
>
>Hi Divy,
>
>You might want to try adding this near the beginning of your 
Queue template
>class:
>
>protected:
>  using std::priority_queue< T, std::vector<T>, PLess<T> >::c;
>  using std::priority_queue< T, std::vector<T>, PLess<T> 
>::comp;
>
>HTH,
>--Eljay
>
>
>
---------End of Included Message----------




More information about the Gcc-help mailing list