linking error with ginac example program derivative.cpp
I am just starting with ginac but unable to build the derivative.cpp program from doc/examples/ in ginac-1.6.2 Others of the examples that I tried were built successfully, eg compile1.cpp and compile3.exe I am using these versions of ginac and cln: cln-1.3.2 ginac-1.6.2 These libraries were built without problems as per INSTALL instructions. compiler (gcc --version): gcc (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125) platform (uname -a): CYGWIN_NT-5.1 dell 1.7.15(0.260/5/3) 2012-05-09 10:25 i686 Cygwin 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 someone tell me what is going wrong?
Hi Robert, sorry, I can not reproduce your problem. I have no problems compiling that example, but I have to say I use g++ 4.7 on a Linux box. I used your commands (without the -DIN_GINAC), and I used the following: g++ `pkg-config ginac --libs --cflags` derivative.cpp -o derivative which is a bit more concise. Maybe you can try that line as well, maybe something is wrong with the paths of your installation. Regards, Jens On 11.07.2012 14:54, Robert Durkacz wrote:
I am just starting with ginac but unable to build the derivative.cpp program from doc/examples/ in ginac-1.6.2 Others of the examples that I tried were built successfully, eg compile1.cpp and compile3.exe
I am using these versions of ginac and cln: cln-1.3.2 ginac-1.6.2 These libraries were built without problems as per INSTALL instructions.
compiler (gcc --version): gcc (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
platform (uname -a): CYGWIN_NT-5.1 dell 1.7.15(0.260/5/3) 2012-05-09 10:25 i686 Cygwin
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 someone tell me what is going wrong? _______________________________________________ GiNaC-list mailing list GiNaC-list@ginac.de https://www.cebix.net/mailman/listinfo/ginac-list
Thankyou. I will try your command line and report if that helps. -Robert On Fri, Jul 13, 2012 at 5:21 AM, Jens Vollinga <jens.vollinga@googlemail.com> wrote:
Hi Robert,
sorry, I can not reproduce your problem. I have no problems compiling that example, but I have to say I use g++ 4.7 on a Linux box.
I used your commands (without the -DIN_GINAC), and I used the following:
g++ `pkg-config ginac --libs --cflags` derivative.cpp -o derivative
which is a bit more concise. Maybe you can try that line as well, maybe something is wrong with the paths of your installation.
Regards, Jens
On 11.07.2012 14:54, Robert Durkacz wrote:
I am just starting with ginac but unable to build the derivative.cpp program from doc/examples/ in ginac-1.6.2 Others of the examples that I tried were built successfully, eg compile1.cpp and compile3.exe
I am using these versions of ginac and cln: cln-1.3.2 ginac-1.6.2 These libraries were built without problems as per INSTALL instructions.
compiler (gcc --version): gcc (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
platform (uname -a): CYGWIN_NT-5.1 dell 1.7.15(0.260/5/3) 2012-05-09 10:25 i686 Cygwin
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 someone tell me what is going wrong? _______________________________________________ GiNaC-list mailing list GiNaC-list@ginac.de https://www.cebix.net/mailman/listinfo/ginac-list
_______________________________________________ GiNaC-list mailing list GiNaC-list@ginac.de https://www.cebix.net/mailman/listinfo/ginac-list
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
Hello, On Wed, Jul 11, 2012 at 10:54:24PM +1000, Robert Durkacz wrote:
I am just starting with ginac but unable to build the derivative.cpp program from doc/examples/ in ginac-1.6.2 Others of the examples that I tried were built successfully, eg compile1.cpp and compile3.exe
I am using these versions of ginac and cln: cln-1.3.2 ginac-1.6.2 These libraries were built without problems as per INSTALL instructions.
compiler (gcc --version): gcc (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
platform (uname -a): CYGWIN_NT-5.1 dell 1.7.15(0.260/5/3) 2012-05-09 10:25 i686 Cygwin
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 someone tell me what is going wrong?
This is a bug in GiNaC. It has been fixed in git (commit e5eeee53d814, ` [bugfix] Always #include <lst.h> before using lst. Fixes build error on MinGW.'). Could you please verify if the fix works for you? Best regards, Alexei
On Tue, Jul 17, 2012 at 2:01 PM, Alexei Sheplyakov <alexei.sheplyakov@gmail.com> wrote:
This is a bug in GiNaC. It has been fixed in git (commit e5eeee53d814, ` [bugfix] Always #include <lst.h> before using lst. Fixes build error on MinGW.'). Could you please verify if the fix works for you?
It does indeed work for me on cygwin. (I don't think I need to verify the previously suggested, similar, patch.) Thankyou, Robert Durkacz
participants (3)
-
Alexei Sheplyakov
-
Jens Vollinga
-
Robert Durkacz