[GiNaC-list] linking error with ginac example program derivative.cpp

Alexei Sheplyakov alexei.sheplyakov at gmail.com
Mon Jul 16 07:16:59 CEST 2012


Hi,

On Wed, Jul 11, 2012 at 10:54:24PM +1000, Robert Durkacz wrote:

> command line of compile and link steps:
>     g++ -c -Wall -g -I.. -I../ginac -DIN_GINAC  -o gcc/derivative.o
> derivative.cpp
>     g++ -o derivative gcc/derivative.o ../ginac/.libs/libginac.a
> /usr/local/lib/libcln.a -ldl
>     ../ginac/.libs/libginac.a(parser.o): In function
> `_ZNSt16invalid_argumentD1Ev':
>     /home/Owner/technical/ginac-1.6.2/ginac/parser/parser.h:46:
> multiple definition of `GiNaC::container<std::list>::info(unsigned
> int) const'
>     ../ginac/.libs/libginac.a(lst.o):/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:(.text+0x0):
> first defined here
>     collect2: ld returned 1 exit status
> It is beyond my current abilities to sort out this problem.

Could you please try this patch:

diff --git a/ginac/lst.cpp b/ginac/lst.cpp
index a2b2613..845750e 100644
--- a/ginac/lst.cpp
+++ b/ginac/lst.cpp
@@ -29,15 +29,6 @@ template <> GINAC_IMPLEMENT_REGISTERED_CLASS_OPT_T(lst, basic,
   print_func<print_context>(&lst::do_print).
   print_func<print_tree>(&lst::do_print_tree))
 
-/** Specialization of container::info() for lst. */
-template <> bool lst::info(unsigned inf) const
-{
-	if (inf == info_flags::list)
-		return true;
-	else
-		return inherited::info(inf);
-}
-
 GINAC_BIND_UNARCHIVER(lst);
 
 } // namespace GiNaC
diff --git a/ginac/lst.h b/ginac/lst.h
index 6e06b76..007d1bd 100644
--- a/ginac/lst.h
+++ b/ginac/lst.h
@@ -40,8 +40,15 @@ template<> inline char lst::get_open_delim() { return '{'; }
 /** Specialization of container::get_close_delim() for lst. */
 template<> inline char lst::get_close_delim() { return '}'; }
 
-// defined in lst.cpp
-template<> bool lst::info(unsigned inf) const;
+/** Specialization of container::info() for lst. */
+template<> inline bool lst::info(unsigned inf) const
+{
+	if (inf == info_flags::list)
+		return true;
+	else
+		return inherited::info(inf);
+}
+
 GINAC_DECLARE_UNARCHIVER(lst);
 
 } // namespace GiNaC



Best regards,
	Alexei



More information about the GiNaC-list mailing list