This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Critical behavioral change between g++-4.4/g++-4.5 and g++-4.6 ?


Wrong mailing list, you are looking for gcc-help.

On Sun, 21 Aug 2011, Emmanuel Fleury wrote:

I was trying to compile a project called kyua with g++-4.6 and I did hit a linking error. It seems that a method was missing.

After some discussions with the main developer of the project, it appeared that depending on the version of g++ we were using the build was going nicely (g++-4.4/g++-4.5) or was hitting a linking error (g++-4.6).

Here is the error:

cli/cmd_about_test.cpp:106: error: undefined reference to 'utils::cmdline::base_command<engine::user_files::config>::main(utils::cmdline::ui*, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, engine::user_files::config const&)'
cli/cmd_about_test.cpp:106: error: undefined reference to 'utils::cmdline::base_command<engine::user_files::config>::main(utils::cmdline::ui*, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, engine::user_files::config const&)'
cli/cmd_about_test.cpp:87: error: undefined reference to 'utils::cmdline::base_command<engine::user_files::config>::main(utils::cmdline::ui*, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, engine::user_files::config const&)'
cli/cmd_about_test.cpp:87: error: undefined reference to 'utils::cmdline::base_command<engine::user_files::config>::main(utils::cmdline::ui*, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, engine::user_files::config const&)'
collect2: ld returned 1 exit status


And, indeed, when getting the symbols from the static libraries built with g++-4.4 (I had it on my system, but I can install g++-4.5 if needed) and g++-4.6, I got the following output (you will see that the method requested by the linker is missing in libcli.a):
[...]
So, now, I am looking for help to know if the problem is coming from the code or from g++-4.6.

From the code. The definition (not just declaration) of templates should
be available everywhere they are used (or you can manually force instantiation in one translation unit and inhibit it in the others).

(sorry I didn't manage to circumvent the problem to a small piece of code),

Er, what did you try?


--
Marc Glisse


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]