Problems Compiling in SUSE 10
Hello. I used to work in SuSE 9.2, programming in C++. And i'm working on a program that use a STL template (queue). After i made the upgrade for SuSE 10 the program does not compile anymore! Gives some erros regarding the template declaration and some linking problems with stdc++ library. I've already notice that the gcc version is diferent and the locations of the header and libraries are also different. But the compability should be done!!?? If anyone already have this problem and solved it please report the solution to the list Thanks in advance -- Jorge Almeida j-almeida@criticalsoftware.com DISCLAIMER: This message may contain confidential information or privileged material and is intended only for the individual(s) named. If you are not a named addressee and mistakenly received this message you should not copy or otherwise disseminate it: please delete this e-mail from your system and notify the sender immediately. E-mail transmissions are not guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete or contain viruses. Therefore, the sender does not accept liability for any errors or omissions in the contents of this message that arise as a result of e-mail transmissions. Please request a hard copy version if verification is required. Critical Software.
Jorge Almeida wrote:
Hello.
I used to work in SuSE 9.2, programming in C++. And i'm working on a program that use a STL template (queue).
After i made the upgrade for SuSE 10 the program does not compile anymore! Gives some erros regarding the template declaration and some linking problems with stdc++ library.
I've already notice that the gcc version is diferent and the locations of the header and libraries are also different. But the compability should be done!!??
If anyone already have this problem and solved it please report the solution to the list
Thanks in advance
What are the errors displayed? I know I had to compile my own version of GCC3 to get some of my development off the ground on 10.0. LDB
The errors are the following: For the lib: ############################################### /usr/local/lib/libccext2.so: undefined reference to `__gnu_cxx::__exchange_and_add(int volatile*, int)' /usr/local/lib/libccext2.so: undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)' /usr/local/lib/libccext2.so: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_S_empty_rep_storage' /usr/local/lib/libccext2.so: undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::seekoff(long long, std::_Ios_Seekdir, std::_Ios_Openmode)' /usr/local/lib/libccext2.so: undefined reference to `std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)' /usr/local/lib/libccext2.so: undefined reference to `std::_Rb_tree_rebalance_for_erase(std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)' /usr/local/lib/libccext2.so: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)' collect2: ld returned 1 exit status ############################################## and for the source template: ############################################### compiling CMiceReadQueues.cpp (g++) /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘void CMiceQueue<T>::Reserve(size_t)’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:205: error: ‘c’ was not declared in this scope if g++ -DHAVE_CONFIG_H -I. -I/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues -I../../.. -I/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/ciniparserwrapper -I/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/ciniparserwrapper/iniparser -I/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/headers -I/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues -I/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/systemlog -I/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/utils -I/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/message -O0 -Werror -Wall -Wnon-virtual-dtor -g3 -I/usr/local/include/cc++2 -D_GNU_SOURCE -MT CMiceWriteQueues.o -M /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘void CMiceQueue<T>::Clear()’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:233: error: ‘c’ was not declared in this scope /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘const T& CMiceQueue<T>::Top() const’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:290: error: there are no arguments to ‘top’ that depend on a template parameter, so a declaration of ‘top’ must be available /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:290: error: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated D -MP -MF ".deps/CMiceWriteQueues.Tpo" -c -o CMiceWriteQueues.o /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceWriteQueues.cpp; then mv -f ".deps/CMiceWriteQueues.Tpo" ".deps/CMiceWriteQueues.Po"; else rm -f ".deps/CMiceWriteQueues.Tpo"; exit 1; fi ) /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘void CMiceQueue<T>::Pop()’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:318: error: there are no arguments to ‘size’ that depend on a template parameter, so a declaration of ‘size’ must be available /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:319: error: there are no arguments to ‘pop’ that depend on a template parameter, so a declaration of ‘pop’ must be available /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘bool CMiceQueue<T>::Empty() const’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:348: error: ‘c’ was not declared in this scope /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘size_t CMiceQueue<T>::Size() const’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:376: error: ‘c’ was not declared in this scope gmake[4]: *** [CMiceReadQueues.o] Error 1 /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘void CMiceQueue<T>::Reserve(size_t)’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:205: error: ‘c’ was not declared in this scope /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘void CMiceQueue<T>::Clear()’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:233: error: ‘c’ was not declared in this scope /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘const T& CMiceQueue<T>::Top() const’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:290: error: there are no arguments to ‘top’ that depend on a template parameter, so a declaration of ‘top’ must be available /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:290: error: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated) /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘void CMiceQueue<T>::Pop()’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:318: error: there are no arguments to ‘size’ that depend on a template parameter, so a declaration of ‘size’ must be available /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:319: error: there are no arguments to ‘pop’ that depend on a template parameter, so a declaration of ‘pop’ must be available /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘bool CMiceQueue<T>::Empty() const’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:348: error: ‘c’ was not declared in this scope /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘size_t CMiceQueue<T>::Size() const’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:376: error: ‘c’ was not declared in this scope gmake[4]: *** [CMiceWriteQueues.o] Error 1 gmake[4]: Target `all' not remade because of errors. Making all in cmonitoring compiling CManagement.cpp (g++) /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘void CMiceQueue<T>::Reserve(size_t)’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:205: error: ‘c’ was not declared in this scope /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘void CMiceQueue<T>::Clear()’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:233: error: ‘c’ was not declared in this scope /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘const T& CMiceQueue<T>::Top() const’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:290: error: there are no arguments to ‘top’ that depend on a template parameter, so a declaration of ‘top’ must be available /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:290: error: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated) /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘void CMiceQueue<T>::Pop()’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:318: error: there are no arguments to ‘size’ that depend on a template parameter, so a declaration of ‘size’ must be available /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:319: error: there are no arguments to ‘pop’ that depend on a template parameter, so a declaration of ‘pop’ must be available /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘bool CMiceQueue<T>::Empty() const’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:348: error: ‘c’ was not declared in this scope /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘size_t CMiceQueue<T>::Size() const’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:376: error: ‘c’ was not declared in this scope ############################################################# and more that i do not copy because are similar. I've noticed that SUSE 10 come with version 4.0.X of GCC. Maybe that is the problem. Thanks. Em Wednesday 21 December 2005 15:58, o LDB escreveu:
Jorge Almeida wrote:
Hello.
I used to work in SuSE 9.2, programming in C++. And i'm working on a program that use a STL template (queue).
After i made the upgrade for SuSE 10 the program does not compile anymore! Gives some erros regarding the template declaration and some linking problems with stdc++ library.
I've already notice that the gcc version is diferent and the locations of the header and libraries are also different. But the compability should be done!!??
If anyone already have this problem and solved it please report the solution to the list
Thanks in advance
What are the errors displayed?
I know I had to compile my own version of GCC3 to get some of my development off the ground on 10.0.
LDB
-- Jorge Almeida j-almeida@criticalsoftware.com DISCLAIMER: This message may contain confidential information or privileged material and is intended only for the individual(s) named. If you are not a named addressee and mistakenly received this message you should not copy or otherwise disseminate it: please delete this e-mail from your system and notify the sender immediately. E-mail transmissions are not guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete or contain viruses. Therefore, the sender does not accept liability for any errors or omissions in the contents of this message that arise as a result of e-mail transmissions. Please request a hard copy version if verification is required. Critical Software.
I do not have to tell you that you have linking problems, obviously. :) I would carefully compile GCC3 and put it in different hierarchy using something like .. ../gcc-3.4.5/configure --prefix=/usr/local/gcc --enable-threads --enable-shared --enable-languages=c,c++ --with-libiconv-prefix=/usr then see if it is the compiler. My guess is that it is GCC4. I have had too many problems with it thus to the point where I am thinking about going back to 9.3. LDB Jorge Almeida wrote:
The errors are the following:
For the lib: ############################################### /usr/local/lib/libccext2.so: undefined reference to `__gnu_cxx::__exchange_and_add(int volatile*, int)' /usr/local/lib/libccext2.so: undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)' /usr/local/lib/libccext2.so: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_S_empty_rep_storage' /usr/local/lib/libccext2.so: undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::seekoff(long long, std::_Ios_Seekdir, std::_Ios_Openmode)' /usr/local/lib/libccext2.so: undefined reference to `std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)' /usr/local/lib/libccext2.so: undefined reference to `std::_Rb_tree_rebalance_for_erase(std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)' /usr/local/lib/libccext2.so: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)' collect2: ld returned 1 exit status ##############################################
and for the source template:
############################################### compiling CMiceReadQueues.cpp (g++) /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘void CMiceQueue<T>::Reserve(size_t)’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:205: error: ‘c’ was not declared in this scope if g++ -DHAVE_CONFIG_H -I. -I/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues -I../../.. -I/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/ciniparserwrapper -I/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/ciniparserwrapper/iniparser -I/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/headers -I/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues -I/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/systemlog -I/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/utils -I/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/message -O0 -Werror -Wall -Wnon-virtual-dtor -g3 -I/usr/local/include/cc++2 -D_GNU_SOURCE -MT CMiceWriteQueues.o -M /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘void CMiceQueue<T>::Clear()’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:233: error: ‘c’ was not declared in this scope /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘const T& CMiceQueue<T>::Top() const’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:290: error: there are no arguments to ‘top’ that depend on a template parameter, so a declaration of ‘top’ must be available /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:290: error: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated D -MP -MF ".deps/CMiceWriteQueues.Tpo" -c -o CMiceWriteQueues.o /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceWriteQueues.cpp; then mv -f ".deps/CMiceWriteQueues.Tpo" ".deps/CMiceWriteQueues.Po"; else rm -f ".deps/CMiceWriteQueues.Tpo"; exit 1; fi ) /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘void CMiceQueue<T>::Pop()’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:318: error: there are no arguments to ‘size’ that depend on a template parameter, so a declaration of ‘size’ must be available /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:319: error: there are no arguments to ‘pop’ that depend on a template parameter, so a declaration of ‘pop’ must be available /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘bool CMiceQueue<T>::Empty() const’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:348: error: ‘c’ was not declared in this scope /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘size_t CMiceQueue<T>::Size() const’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:376: error: ‘c’ was not declared in this scope gmake[4]: *** [CMiceReadQueues.o] Error 1 /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘void CMiceQueue<T>::Reserve(size_t)’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:205: error: ‘c’ was not declared in this scope /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘void CMiceQueue<T>::Clear()’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:233: error: ‘c’ was not declared in this scope /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘const T& CMiceQueue<T>::Top() const’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:290: error: there are no arguments to ‘top’ that depend on a template parameter, so a declaration of ‘top’ must be available /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:290: error: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated) /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘void CMiceQueue<T>::Pop()’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:318: error: there are no arguments to ‘size’ that depend on a template parameter, so a declaration of ‘size’ must be available /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:319: error: there are no arguments to ‘pop’ that depend on a template parameter, so a declaration of ‘pop’ must be available /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘bool CMiceQueue<T>::Empty() const’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:348: error: ‘c’ was not declared in this scope /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘size_t CMiceQueue<T>::Size() const’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:376: error: ‘c’ was not declared in this scope gmake[4]: *** [CMiceWriteQueues.o] Error 1 gmake[4]: Target `all' not remade because of errors. Making all in cmonitoring compiling CManagement.cpp (g++) /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘void CMiceQueue<T>::Reserve(size_t)’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:205: error: ‘c’ was not declared in this scope /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘void CMiceQueue<T>::Clear()’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:233: error: ‘c’ was not declared in this scope /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘const T& CMiceQueue<T>::Top() const’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:290: error: there are no arguments to ‘top’ that depend on a template parameter, so a declaration of ‘top’ must be available /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:290: error: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated) /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘void CMiceQueue<T>::Pop()’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:318: error: there are no arguments to ‘size’ that depend on a template parameter, so a declaration of ‘size’ must be available /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:319: error: there are no arguments to ‘pop’ that depend on a template parameter, so a declaration of ‘pop’ must be available /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘bool CMiceQueue<T>::Empty() const’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:348: error: ‘c’ was not declared in this scope /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h: In member function ‘size_t CMiceQueue<T>::Size() const’: /home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:376: error: ‘c’ was not declared in this scope #############################################################
and more that i do not copy because are similar.
I've noticed that SUSE 10 come with version 4.0.X of GCC. Maybe that is the problem.
Thanks.
Em Wednesday 21 December 2005 15:58, o LDB escreveu:
Jorge Almeida wrote:
Hello.
I used to work in SuSE 9.2, programming in C++. And i'm working on a program that use a STL template (queue).
After i made the upgrade for SuSE 10 the program does not compile anymore! Gives some erros regarding the template declaration and some linking problems with stdc++ library.
I've already notice that the gcc version is diferent and the locations of the header and libraries are also different. But the compability should be done!!??
If anyone already have this problem and solved it please report the solution to the list
Thanks in advance What are the errors displayed?
I know I had to compile my own version of GCC3 to get some of my development off the ground on 10.0.
LDB
Philipp Thomas wrote:
On Wed, 21 Dec 2005 11:22:55 -0500, LDB wrote:
then see if it is the compiler. My guess is that it is GCC4.
Want to bet it's a bug in the code that gcc3 silently ignored?
Philipp
I was going by what he stated in his email. He said that in SuSE 9.2 he did not have this problem. I am not going to pass judgement on his code because I have no idea about his enviroment. I know I HAD to install GCC3 to re-compile certain applications. So, I was telling him about my experience. :) For his sake, I hope it is not a bug, but you are probably correct, it is most likely a bug that his previous enviroment did not consider to be an error. :) Thanks, LDB
On Wed, 21 Dec 2005 16:08:44 +0000, Jorge Almeida wrote:
/usr/local/lib/libccext2.so: undefined reference to `__gnu_cxx::__exchange_and_add(int volatile*, int)'
Looks like you link with gcc and not g++.
/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:205: error: ‘c’ was not declared in this scope
What is this 'c' the compiler is complaining about? Where should it come from?
/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:290: error: there are no arguments to ‘top’ that depend on a template parameter, so a declaration of ‘top’ must be available
Here's the next likely bug in your code. But without the source code, it's hard to tell what's wrong. Can you reduce it to a small test case?
I've noticed that SUSE 10 come with version 4.0.X of GCC. Maybe that is the problem.
No, the problem is probably your code! gcc4 just is more standards conforming and rejects code it formerly accepted. So if gcc4 is now complaining, chances are high that your code is not conforming to the ISO C++ standard. Philipp
On Wed, 21 Dec 2005 16:08:44 +0000, Jorge Almeida wrote:
/usr/local/lib/libccext2.so: undefined reference to `__gnu_cxx::__exchange_and_add(int volatile*, int)'
Looks like you link with gcc and not g++. I didn't have time to look at this much yesterday, but I think Philipp is correct. When building c++ or mixed C and C++ objects, you need to
On Thu, 22 Dec 2005 10:47:55 +0100 Philipp Thomas <philipp.thomas@t-link.de> wrote: link with g++. This is because the GCC driver will not automatically link with the C++ libraries. Using g++, the C++ libraries will be automatically added. -- Jerry Feldman <gaf@blu.org> Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
Well. I'm using Kdevelop to manage all the project questions regarding the choice of compilers and libraries to link. And i'm using the Common C++ library thats were the linking problem occurs. But the library is instaled and when the configure script is looking for it, find it in the specified location. For the stl template the code is in attachment. This code is inserted in a bigger project. I've already tried to install GCC 3.4.5 but the problem persists. Thanks for any help. Em Thursday 22 December 2005 12:12, o Jerry Feldman escreveu:
On Thu, 22 Dec 2005 10:47:55 +0100
Philipp Thomas <philipp.thomas@t-link.de> wrote:
On Wed, 21 Dec 2005 16:08:44 +0000, Jorge Almeida wrote:
/usr/local/lib/libccext2.so: undefined reference to `__gnu_cxx::__exchange_and_add(int volatile*, int)'
Looks like you link with gcc and not g++.
I didn't have time to look at this much yesterday, but I think Philipp is correct. When building c++ or mixed C and C++ objects, you need to link with g++. This is because the GCC driver will not automatically link with the C++ libraries. Using g++, the C++ libraries will be automatically added.
-- Jorge Almeida j-almeida@criticalsoftware.com DISCLAIMER: This message may contain confidential information or privileged material and is intended only for the individual(s) named. If you are not a named addressee and mistakenly received this message you should not copy or otherwise disseminate it: please delete this e-mail from your system and notify the sender immediately. E-mail transmissions are not guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete or contain viruses. Therefore, the sender does not accept liability for any errors or omissions in the contents of this message that arise as a result of e-mail transmissions. Please request a hard copy version if verification is required. Critical Software.
On Thu, 22 Dec 2005 17:04:35 +0000, Jorge Almeida wrote:
For the stl template the code is in attachment. This code is inserted in a bigger project.
template <class T> void CMiceQueue<T>::Reserve(size_t un_size) { c.reserve(un_size); ^^ } template <class T> void CMiceQueue<T>::Clear(void) { c.clear(); ^^ } template <class T> bool CMiceQueue<T>::Empty(void) const { return c.empty();^ ^^ } template <class T> size_t CMiceQueue<T>::Size(void) const { return c.size(); ^^ } Four times 'c' is referenced but at least in this header there is no definition of it. Philipp
If you look at "/usr/include/c++/4.0.2/bits/" for the file "stl_queue.h" in line 139, the "c" variable is defined there. And the commentary above the declaration is the following : " /** * 'c' is the underlying container. Maintainers wondering why * this isn't uglified as per style guidelines should note that * this name is specified in the standard, [23.2.3.1]. (Why? * Presumably for the same reason that it's protected instead * of private: to allow derivation. But none of the other * containers allow for derivation. Odd.) */ _Sequence c; " Thats why is not need to declare the variable "c", it should be there for derivation from the queue class. But maybe you have right and i have a mistake that gcc 3.x ignores (but its not likely). Any help is well received. Em Friday 23 December 2005 08:23, o Philipp Thomas escreveu:
On Thu, 22 Dec 2005 17:04:35 +0000, Jorge Almeida wrote:
For the stl template the code is in attachment. This code is inserted in a bigger project.
template <class T> void CMiceQueue<T>::Reserve(size_t un_size) { c.reserve(un_size); ^^ }
template <class T> void CMiceQueue<T>::Clear(void) { c.clear(); ^^ }
template <class T> bool CMiceQueue<T>::Empty(void) const { return c.empty();^ ^^ }
template <class T> size_t CMiceQueue<T>::Size(void) const { return c.size(); ^^ }
Four times 'c' is referenced but at least in this header there is no definition of it.
Philipp
-- Jorge Almeida j-almeida@criticalsoftware.com DISCLAIMER: This message may contain confidential information or privileged material and is intended only for the individual(s) named. If you are not a named addressee and mistakenly received this message you should not copy or otherwise disseminate it: please delete this e-mail from your system and notify the sender immediately. E-mail transmissions are not guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete or contain viruses. Therefore, the sender does not accept liability for any errors or omissions in the contents of this message that arise as a result of e-mail transmissions. Please request a hard copy version if verification is required. Critical Software.
Jorge Almeida wrote:
Thats why is not need to declare the variable "c", it should be there for derivation from the queue class.
OK, could you then please add -save-temps to the compiler flags and send me the (compressed) resulting .ii file? I need to see where the compiler fails and with what error message. Philipp
Well. I'm using Kdevelop to manage all the project questions regarding the choice of compilers and libraries to link. And i'm using the Common C++ library thats were the linking problem occurs. But the library is instaled and when the configure script is looking for it, find it in the specified location. For the stl template the code is in attachment. This code is inserted in a bigger project. I've already tried to install GCC 3.4.5 but the problem persists. Thanks for any help. Em Thursday 22 December 2005 12:12, o Jerry Feldman escreveu:
On Thu, 22 Dec 2005 10:47:55 +0100
Philipp Thomas <philipp.thomas@t-link.de> wrote:
On Wed, 21 Dec 2005 16:08:44 +0000, Jorge Almeida wrote:
/usr/local/lib/libccext2.so: undefined reference to `__gnu_cxx::__exchange_and_add(int volatile*, int)'
Looks like you link with gcc and not g++.
I didn't have time to look at this much yesterday, but I think Philipp is correct. When building c++ or mixed C and C++ objects, you need to link with g++. This is because the GCC driver will not automatically link with the C++ libraries. Using g++, the C++ libraries will be automatically added.
-- Jorge Almeida j-almeida@criticalsoftware.com DISCLAIMER: This message may contain confidential information or privileged material and is intended only for the individual(s) named. If you are not a named addressee and mistakenly received this message you should not copy or otherwise disseminate it: please delete this e-mail from your system and notify the sender immediately. E-mail transmissions are not guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete or contain viruses. Therefore, the sender does not accept liability for any errors or omissions in the contents of this message that arise as a result of e-mail transmissions. Please request a hard copy version if verification is required. Critical Software.
OK, now that I'm back from holiday I've had another look at it and found at least one bug that leads to the errors. * Jorge Almeida (j-almeida@criticalsoftware.com) [20051221 17:06]:
/usr/local/lib/libccext2.so: undefined reference to `__gnu_cxx::__exchange_and_add(int volatile*, int)' /usr/local/lib/libccext2.so: undefined reference to
Are you shure that version of libccext2.so was linked against the same libstdc++ as on your system? These
/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:205: error: ‘c’ was not declared in this scope
/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:233: error: ‘c’ was not declared in this scope
/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:290: error: there are no arguments to ‘top’ that depend on a template parameter, so a declaration of ‘top’ must be available
/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:318: error: there are no arguments to ‘size’ that depend on a template parameter, so a declaration of ‘size’ must be available
/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:319: error: there are no arguments to ‘pop’ that depend on a template parameter, so a declaration of ‘pop’ must be available
/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:348: error: ‘c’ was not declared in this scope
/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementation/smice/./common/linux/queues/CMiceQueue.h:376: error: ‘c’ was not declared in this scope
All these are called from within template functions but are not dependent on a template parameter, just as the compiler tells you. This is one of the cases where the compiler got more standard conforming and thus rejects the code. So what you have to do is make these template dependent by accessing them via the this pointer. Here is a patch for Template.h that does just this and also contains two other unrelated fixes: a) include cerrno instead of errno.h b) *NEVER* pull symbols into the global namespace in a header! This is OK for normal source files but headers should not do this as it makes namespaces useless Have fun Philipp --- Template.h.old 2006-01-02 17:01:10.992116161 +0100 +++ Template.h 2006-01-02 16:49:12.329953305 +0100 @@ -1,19 +1,15 @@ - #ifndef _CMICEQUEUE_H_ #define _CMICEQUEUE_H_ #include <semaphore.h> #include <vector> #include <queue> -#include <errno.h> +#include <cerrno> #include <cc++/thread.h> #include "CTime.h" #include "CEthernetMessage.h" -using namespace std; -using namespace ost; - template <class T> class CMiceQueue : protected std::priority_queue<T, std::vector<T>, std::greater<T> > { @@ -73,44 +69,44 @@ template <class T> void CMiceQueue<T>::Reserve(size_t un_size) { - c.reserve(un_size); + this->c.reserve(un_size); } template <class T> void CMiceQueue<T>::Clear(void) { - c.clear(); + this->c.clear(); } template <class T> void CMiceQueue<T>::Push(const T& rt_arg) { - push(rt_arg); + this->push(rt_arg); } template <class T> const T& CMiceQueue<T>::Top(void) const { - return top(); + return this->top(); } template <class T> void CMiceQueue<T>::Pop(void) { - if (size() > 0) { - pop(); + if (this->size() > 0) { + this->pop(); } } template <class T> bool CMiceQueue<T>::Empty(void) const { - return c.empty(); + return this->c.empty(); } template <class T> size_t CMiceQueue<T>::Size(void) const { - return c.size(); + return this->c.size(); }
Thanks Philipp My project already compiles with the changes that you have told. With just one difference: the line "using namespace ost;" must be there for use with the Mutex variable that is defined there. Thanks for your help and have a happy new year. Jorge Almeida Em Monday 02 January 2006 16:13, o Philipp Thomas escreveu:
OK, now that I'm back from holiday I've had another look at it and found at least one bug that leads to the errors.
* Jorge Almeida (j-almeida@criticalsoftware.com) [20051221 17:06]:
/usr/local/lib/libccext2.so: undefined reference to `__gnu_cxx::__exchange_and_add(int volatile*, int)' /usr/local/lib/libccext2.so: undefined reference to
Are you shure that version of libccext2.so was linked against the same libstdc++ as on your system?
These
/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementa tion/smice/./common/linux/queues/CMiceQueue.h:205: error: ‘c’ was not declared in this scope
/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementa tion/smice/./common/linux/queues/CMiceQueue.h:233: error: ‘c’ was not declared in this scope
/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementa tion/smice/./common/linux/queues/CMiceQueue.h:290: error: there are no arguments to ‘top’ that depend on a template parameter, so a declaration of ‘top’ must be available
/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementa tion/smice/./common/linux/queues/CMiceQueue.h:318: error: there are no arguments to ‘size’ that depend on a template parameter, so a declaration of ‘size’ must be available
/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementa tion/smice/./common/linux/queues/CMiceQueue.h:319: error: there are no arguments to ‘pop’ that depend on a template parameter, so a declaration of ‘pop’ must be available
/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementa tion/smice/./common/linux/queues/CMiceQueue.h:348: error: ‘c’ was not declared in this scope
/home/jorge/cvs_critical/marinha/direccao-navios/sistemas-mice/implementa tion/smice/./common/linux/queues/CMiceQueue.h:376: error: ‘c’ was not declared in this scope
All these are called from within template functions but are not dependent on a template parameter, just as the compiler tells you. This is one of the cases where the compiler got more standard conforming and thus rejects the code.
So what you have to do is make these template dependent by accessing them via the this pointer.
Here is a patch for Template.h that does just this and also contains two other unrelated fixes: a) include cerrno instead of errno.h b) *NEVER* pull symbols into the global namespace in a header! This is OK for normal source files but headers should not do this as it makes namespaces useless
Have fun Philipp
--- Template.h.old 2006-01-02 17:01:10.992116161 +0100 +++ Template.h 2006-01-02 16:49:12.329953305 +0100 @@ -1,19 +1,15 @@ - #ifndef _CMICEQUEUE_H_ #define _CMICEQUEUE_H_
#include <semaphore.h> #include <vector> #include <queue> -#include <errno.h> +#include <cerrno> #include <cc++/thread.h>
#include "CTime.h" #include "CEthernetMessage.h"
-using namespace std; -using namespace ost; - template <class T> class CMiceQueue : protected std::priority_queue<T, std::vector<T>, std::greater<T> > { @@ -73,44 +69,44 @@
template <class T> void CMiceQueue<T>::Reserve(size_t un_size) { - c.reserve(un_size); + this->c.reserve(un_size); }
template <class T> void CMiceQueue<T>::Clear(void) { - c.clear(); + this->c.clear(); }
template <class T> void CMiceQueue<T>::Push(const T& rt_arg) { - push(rt_arg); + this->push(rt_arg); }
template <class T> const T& CMiceQueue<T>::Top(void) const { - return top(); + return this->top(); }
template <class T> void CMiceQueue<T>::Pop(void) { - if (size() > 0) { - pop(); + if (this->size() > 0) { + this->pop(); } }
template <class T> bool CMiceQueue<T>::Empty(void) const { - return c.empty(); + return this->c.empty(); }
template <class T> size_t CMiceQueue<T>::Size(void) const { - return c.size(); + return this->c.size(); }
-- Jorge Almeida j-almeida@criticalsoftware.com DISCLAIMER: This message may contain confidential information or privileged material and is intended only for the individual(s) named. If you are not a named addressee and mistakenly received this message you should not copy or otherwise disseminate it: please delete this e-mail from your system and notify the sender immediately. E-mail transmissions are not guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete or contain viruses. Therefore, the sender does not accept liability for any errors or omissions in the contents of this message that arise as a result of e-mail transmissions. Please request a hard copy version if verification is required. Critical Software.
On Mon, 2 Jan 2006 17:44:02 +0000, Jorge Almeida wrote:
My project already compiles with the changes that you have told. With just one difference: the line "using namespace ost;" must be there for use with the Mutex variable that is defined there.
No, just add the namespace qualification to the mutex variable like you do with symbols from namespacwe std, i.e. "std::string my_string".
Thanks for your help and have a happy new year.
Thanks and the same to you. Philipp
participants (5)
-
Jerry Feldman
-
Jorge Almeida
-
LDB
-
Philipp Thomas
-
Philipp Thomas