From: Michal H. <ms...@gm...> - 2009-09-15 09:04:15
|
Hi Jozo, I have started having problems to link test with g++-4.3 because of: testcobjectsimple.cc:(.text._ZN10pdfobjects13CObjectSimpleILNS_12PropertyTypeE3EEC1EN5boost8weak_ptrINS_4CPdfEEERK6ObjectRKNS_7IndiRefE[pdfobjects::CObjectSimple<(pdfobjects::PropertyType)3>::CObjectSimple(boost::weak_ptr<pdfobjects::CPdf>, Object const&, pdfobjects::IndiRef const&)]+0x6f): undefined reference to `void pdfobjects::utils::simpleValueFromXpdfObj<(pdfobjects::PropertyType)3, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(Object const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)' collect2: ld returned 1 exit status Strangely enough this doesn't happen if I compile with g++-4.1 (I haven't tried other versions yet). AFAIU, the problem is that simpleValueFromXpdfObj<pString, std::string&>(const Object&, string&) is not defined and it is required by: testcobjectsimple.cc: 131 CString s (pdf,obj,ref); CString is just typedef to CObjectSimple<pString> and the used constructor calls utils::simpleValueFromXpdfObj<pString, string&>. src/kernel $ grep simpleValueFromXpdfObj -I * cobject2string.cc: simpleValueFromXpdfObj<pReal, double&> (*ptrObj, val); cobject2xpdf.cc:simpleValueFromXpdfObj (const Object& obj, T val) cobject2xpdf.cc:simpleValueFromXpdfObj<pNull,NullType&> (const Object&, NullType&) cobjectsimple.h:template <PropertyType Tp,typename T> void simpleValueFromXpdfObj (const ::Object& obj, T val); cobjectsimpleI.h: utils::simpleValueFromXpdfObj<Tp,Value&> (o,value); cobjectsimpleI.h: utils::simpleValueFromXpdfObj<Tp,Value&> (o,value); This means that the only definition of this template function is in cc module and not in header file. I thought that this is not correct wrt. to the current state of C++ compilers. I am also wondering why other constructors (e.g. CReal) are not any problem... When I comment out the offending line I don't get linkage error. How should we address this? -- Michal Hocko |
From: Michal H. <ms...@gm...> - 2009-09-15 09:18:35
|
On Tue, Sep 15, 2009 at 11:04:01AM +0200, Michal Hocko wrote: > Hi Jozo, > I have started having problems to link test with g++-4.3 because of: > testcobjectsimple.cc:(.text._ZN10pdfobjects13CObjectSimpleILNS_12PropertyTypeE3EEC1EN5boost8weak_ptrINS_4CPdfEEERK6ObjectRKNS_7IndiRefE[pdfobjects::CObjectSimple<(pdfobjects::PropertyType)3>::CObjectSimple(boost::weak_ptr<pdfobjects::CPdf>, Object const&, pdfobjects::IndiRef const&)]+0x6f): undefined reference to `void pdfobjects::utils::simpleValueFromXpdfObj<(pdfobjects::PropertyType)3, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(Object const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)' > collect2: ld returned 1 exit status Just to mention that this is not caused by any of the recent changes because the same error is present on all PDFedit versions since 0.4.0 (I haven't checked older version). > > Strangely enough this doesn't happen if I compile with g++-4.1 (I > haven't tried other versions yet). > > AFAIU, the problem is that > simpleValueFromXpdfObj<pString, std::string&>(const Object&, string&) is > not defined and it is required by: > testcobjectsimple.cc: > 131 CString s (pdf,obj,ref); > > CString is just typedef to CObjectSimple<pString> and the used constructor calls > utils::simpleValueFromXpdfObj<pString, string&>. > > src/kernel $ grep simpleValueFromXpdfObj -I * > cobject2string.cc: simpleValueFromXpdfObj<pReal, double&> (*ptrObj, val); > cobject2xpdf.cc:simpleValueFromXpdfObj (const Object& obj, T val) > cobject2xpdf.cc:simpleValueFromXpdfObj<pNull,NullType&> (const Object&, NullType&) > cobjectsimple.h:template <PropertyType Tp,typename T> void simpleValueFromXpdfObj (const ::Object& obj, T val); > cobjectsimpleI.h: utils::simpleValueFromXpdfObj<Tp,Value&> (o,value); > cobjectsimpleI.h: utils::simpleValueFromXpdfObj<Tp,Value&> (o,value); > > This means that the only definition of this template function is in cc > module and not in header file. I thought that this is not correct wrt. > to the current state of C++ compilers. I am also wondering why other > constructors (e.g. CReal) are not any problem... When I comment out > the offending line I don't get linkage error. > How should we address this? > -- > Michal Hocko > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9-12, 2009. Register now! > http://p.sf.net/sfu/devconf > _______________________________________________ > Pdfedit-devel mailing list > Pdf...@li... > https://lists.sourceforge.net/lists/listinfo/pdfedit-devel -- Michal Hocko |
From: Jozef M. <mis...@ho...> - 2009-09-15 10:05:55
|
---------------------------------------- > Date: Tue, 15 Sep 2009 11:04:01 +0200 > From: ms...@gm... > To: mis...@ho... > CC: pdf...@li... > Subject: Problems with tests linking > > Hi Jozo, > I have started having problems to link test with g++-4.3 because of: > testcobjectsimple.cc:(.text._ZN10pdfobjects13CObjectSimpleILNS_12PropertyTypeE3EEC1EN5boost8weak_ptrINS_4CPdfEEERK6ObjectRKNS_7IndiRefE[pdfobjects::CObjectSimple::CObjectSimple(boost::weak_ptr, Object const&, pdfobjects::IndiRef const&)]+0x6f): undefined reference to `void pdfobjects::utils::simpleValueFromXpdfObj&>(Object const&, std::basic_string, std::allocator>&)' > collect2: ld returned 1 exit status > > Strangely enough this doesn't happen if I compile with g++-4.1 (I > haven't tried other versions yet). > > AFAIU, the problem is that > simpleValueFromXpdfObj(const Object&, string&) is > not defined and it is required by: > testcobjectsimple.cc: > 131 CString s (pdf,obj,ref); > > CString is just typedef to CObjectSimple and the used constructor calls > utils::simpleValueFromXpdfObj. > > src/kernel $ grep simpleValueFromXpdfObj -I * > cobject2string.cc: simpleValueFromXpdfObj (*ptrObj, val); > cobject2xpdf.cc:simpleValueFromXpdfObj (const Object& obj, T val) > cobject2xpdf.cc:simpleValueFromXpdfObj (const Object&, NullType&) > cobjectsimple.h:template void simpleValueFromXpdfObj (const ::Object& obj, T val); > cobjectsimpleI.h: utils::simpleValueFromXpdfObj (o,value); > cobjectsimpleI.h: utils::simpleValueFromXpdfObj (o,value); > > This means that the only definition of this template function is in cc > module and not in header file. I thought that this is not correct wrt. > to the current state of C++ compilers. I am also wondering why other > constructors (e.g. CReal) are not any problem... When I comment out > the offending line I don't get linkage error. > How should we address this? explicit template specialization. can you try it as i am not getting these errors. /jm > -- > Michal Hocko _________________________________________________________________ Hotmail: Free, trusted and rich email service. http://clk.atdmt.com/GBL/go/171222984/direct/01/ |
From: Michal H. <ms...@gm...> - 2009-09-15 11:59:04
|
On Tue, Sep 15, 2009 at 10:03:32AM +0000, Jozef Misutka wrote: > > > > Hi Jozo, > > I have started having problems to link test with g++-4.3 because of: > > testcobjectsimple.cc:(.text._ZN10pdfobjects13CObjectSimpleILNS_12PropertyTypeE3EEC1EN5boost8weak_ptrINS_4CPdfEEERK6ObjectRKNS_7IndiRefE[pdfobjects::CObjectSimple::CObjectSimple(boost::weak_ptr, Object const&, pdfobjects::IndiRef const&)]+0x6f): undefined reference to `void pdfobjects::utils::simpleValueFromXpdfObj&>(Object const&, std::basic_string, std::allocator>&)' > > collect2: ld returned 1 exit status > > > > Strangely enough this doesn't happen if I compile with g++-4.1 (I > > haven't tried other versions yet). > > > > AFAIU, the problem is that > > simpleValueFromXpdfObj(const Object&, string&) is > > not defined and it is required by: > > testcobjectsimple.cc: > > 131 CString s (pdf,obj,ref); > > > > CString is just typedef to CObjectSimple and the used constructor calls > > utils::simpleValueFromXpdfObj. > > > > src/kernel $ grep simpleValueFromXpdfObj -I * > > cobject2string.cc: simpleValueFromXpdfObj (*ptrObj, val); > > cobject2xpdf.cc:simpleValueFromXpdfObj (const Object& obj, T val) > > cobject2xpdf.cc:simpleValueFromXpdfObj (const Object&, NullType&) > > cobjectsimple.h:template void simpleValueFromXpdfObj (const ::Object& obj, T val); > > cobjectsimpleI.h: utils::simpleValueFromXpdfObj (o,value); > > cobjectsimpleI.h: utils::simpleValueFromXpdfObj (o,value); > > > > This means that the only definition of this template function is in cc > > module and not in header file. I thought that this is not correct wrt. > > to the current state of C++ compilers. I am also wondering why other > > constructors (e.g. CReal) are not any problem... When I comment out > > the offending line I don't get linkage error. > > How should we address this? > > explicit template specialization. Little bit to generic to me... What should be specialized? CString constructor or simpleValueFromXpdfObj? Patch would be welcome ;) > > can you try it as i am not getting these errors. > > /jm > > > > -- > > Michal Hocko > _________________________________________________________________ > Hotmail: Free, trusted and rich email service. > http://clk.atdmt.com/GBL/go/171222984/direct/01/ -- Michal Hocko |
From: Jozef M. <mis...@ho...> - 2009-09-15 13:27:16
|
---------------------------------------- > Date: Tue, 15 Sep 2009 13:58:52 +0200 > From: ms...@gm... > To: mis...@ho... > CC: pdf...@li... > Subject: Re: Problems with tests linking > > On Tue, Sep 15, 2009 at 10:03:32AM +0000, Jozef Misutka wrote: >>> >>> Hi Jozo, >>> I have started having problems to link test with g++-4.3 because of: >>> testcobjectsimple.cc:(.text._ZN10pdfobjects13CObjectSimpleILNS_12PropertyTypeE3EEC1EN5boost8weak_ptrINS_4CPdfEEERK6ObjectRKNS_7IndiRefE[pdfobjects::CObjectSimple::CObjectSimple(boost::weak_ptr, Object const&, pdfobjects::IndiRef const&)]+0x6f): undefined reference to `void pdfobjects::utils::simpleValueFromXpdfObj&>(Object const&, std::basic_string, std::allocator>&)' >>> collect2: ld returned 1 exit status >>> >>> Strangely enough this doesn't happen if I compile with g++-4.1 (I >>> haven't tried other versions yet). >>> >>> AFAIU, the problem is that >>> simpleValueFromXpdfObj(const Object&, string&) is >>> not defined and it is required by: >>> testcobjectsimple.cc: >>> 131 CString s (pdf,obj,ref); >>> >>> CString is just typedef to CObjectSimple and the used constructor calls >>> utils::simpleValueFromXpdfObj. >>> >>> src/kernel $ grep simpleValueFromXpdfObj -I * >>> cobject2string.cc: simpleValueFromXpdfObj (*ptrObj, val); >>> cobject2xpdf.cc:simpleValueFromXpdfObj (const Object& obj, T val) >>> cobject2xpdf.cc:simpleValueFromXpdfObj (const Object&, NullType&) >>> cobjectsimple.h:template void simpleValueFromXpdfObj (const ::Object& obj, T val); >>> cobjectsimpleI.h: utils::simpleValueFromXpdfObj (o,value); >>> cobjectsimpleI.h: utils::simpleValueFromXpdfObj (o,value); >>> >>> This means that the only definition of this template function is in cc >>> module and not in header file. I thought that this is not correct wrt. >>> to the current state of C++ compilers. I am also wondering why other >>> constructors (e.g. CReal) are not any problem... When I comment out >>> the offending line I don't get linkage error. >>> How should we address this? >> >> explicit template specialization. > > Little bit to generic to me... What should be specialized? CString > constructor or simpleValueFromXpdfObj? Patch would be welcome ;) to remedy this specific error try to add this line after the definition of simpleValueFromXpdfObj template void simpleValueFromXpdfObj (const Object& obj, std::string& val); does it help? more about specialization can be found e.g. http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=/com.ibm.xlcpp8a.doc/language/ref/explicit_specialization.htm /jm > >> >> can you try it as i am not getting these errors. >> >> /jm >> >> >>> -- >>> Michal Hocko >> _________________________________________________________________ >> Hotmail: Free, trusted and rich email service. >> http://clk.atdmt.com/GBL/go/171222984/direct/01/ > > -- > Michal Hocko _________________________________________________________________ Hotmail: Powerful Free email with security by Microsoft. http://clk.atdmt.com/GBL/go/171222986/direct/01/ |
From: Michal H. <ms...@gm...> - 2009-09-15 14:05:08
Attachments:
testcobjectsimple-compile-fix.patch
|
On Tue, Sep 15, 2009 at 01:27:02PM +0000, Jozef Misutka wrote: > > On Tue, Sep 15, 2009 at 10:03:32AM +0000, Jozef Misutka wrote: > >>> > >>> Hi Jozo, > >>> I have started having problems to link test with g++-4.3 because of: > >>> testcobjectsimple.cc:(.text._ZN10pdfobjects13CObjectSimpleILNS_12PropertyTypeE3EEC1EN5boost8weak_ptrINS_4CPdfEEERK6ObjectRKNS_7IndiRefE[pdfobjects::CObjectSimple::CObjectSimple(boost::weak_ptr, Object const&, pdfobjects::IndiRef const&)]+0x6f): undefined reference to `void pdfobjects::utils::simpleValueFromXpdfObj&>(Object const&, std::basic_string, std::allocator>&)' > >>> collect2: ld returned 1 exit status > >>> > >>> Strangely enough this doesn't happen if I compile with g++-4.1 (I > >>> haven't tried other versions yet). > >>> > >>> AFAIU, the problem is that > >>> simpleValueFromXpdfObj(const Object&, string&) is > >>> not defined and it is required by: > >>> testcobjectsimple.cc: > >>> 131 CString s (pdf,obj,ref); > >>> > >>> CString is just typedef to CObjectSimple and the used constructor calls > >>> utils::simpleValueFromXpdfObj. > >>> > >>> src/kernel $ grep simpleValueFromXpdfObj -I * > >>> cobject2string.cc: simpleValueFromXpdfObj (*ptrObj, val); > >>> cobject2xpdf.cc:simpleValueFromXpdfObj (const Object& obj, T val) > >>> cobject2xpdf.cc:simpleValueFromXpdfObj (const Object&, NullType&) > >>> cobjectsimple.h:template void simpleValueFromXpdfObj (const ::Object& obj, T val); > >>> cobjectsimpleI.h: utils::simpleValueFromXpdfObj (o,value); > >>> cobjectsimpleI.h: utils::simpleValueFromXpdfObj (o,value); > >>> > >>> This means that the only definition of this template function is in cc > >>> module and not in header file. I thought that this is not correct wrt. > >>> to the current state of C++ compilers. I am also wondering why other > >>> constructors (e.g. CReal) are not any problem... When I comment out > >>> the offending line I don't get linkage error. > >>> How should we address this? > >> > >> explicit template specialization. > > > > Little bit to generic to me... What should be specialized? CString > > constructor or simpleValueFromXpdfObj? Patch would be welcome ;) > > to remedy this specific error try to add this line after the definition of simpleValueFromXpdfObj > > > template void simpleValueFromXpdfObj (const Object& obj, std::string& val); > > > does it help? Yes, That did the trick. Thanks. Could you review the attached patch (I would like to make it as descriptive as possible if something similar pops out later). Btw. why other types have no problem? Should we add specialized declaration as well? > > > more about specialization can be found e.g. > http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=/com.ibm.xlcpp8a.doc/language/ref/explicit_specialization.htm > > > > /jm > > > > > >> > >> can you try it as i am not getting these errors. > >> > >> /jm > >> > >> > >>> -- > >>> Michal Hocko > >> _________________________________________________________________ > >> Hotmail: Free, trusted and rich email service. > >> http://clk.atdmt.com/GBL/go/171222984/direct/01/ > > > > -- > > Michal Hocko > _________________________________________________________________ > Hotmail: Powerful Free email with security by Microsoft. > http://clk.atdmt.com/GBL/go/171222986/direct/01/ -- Michal Hocko |
From: Jozef M. <mis...@ho...> - 2009-09-15 14:24:04
|
---------------------------------------- > Date: Tue, 15 Sep 2009 16:04:49 +0200 > From: ms...@gm... > To: mis...@ho... > CC: pdf...@li... > Subject: Re: Problems with tests linking > > On Tue, Sep 15, 2009 at 01:27:02PM +0000, Jozef Misutka wrote: >>> On Tue, Sep 15, 2009 at 10:03:32AM +0000, Jozef Misutka wrote: >>>>> >>>>> Hi Jozo, >>>>> I have started having problems to link test with g++-4.3 because of: >>>>> testcobjectsimple.cc:(.text._ZN10pdfobjects13CObjectSimpleILNS_12PropertyTypeE3EEC1EN5boost8weak_ptrINS_4CPdfEEERK6ObjectRKNS_7IndiRefE[pdfobjects::CObjectSimple::CObjectSimple(boost::weak_ptr, Object const&, pdfobjects::IndiRef const&)]+0x6f): undefined reference to `void pdfobjects::utils::simpleValueFromXpdfObj&>(Object const&, std::basic_string, std::allocator>&)' >>>>> collect2: ld returned 1 exit status >>>>> >>>>> Strangely enough this doesn't happen if I compile with g++-4.1 (I >>>>> haven't tried other versions yet). >>>>> >>>>> AFAIU, the problem is that >>>>> simpleValueFromXpdfObj(const Object&, string&) is >>>>> not defined and it is required by: >>>>> testcobjectsimple.cc: >>>>> 131 CString s (pdf,obj,ref); >>>>> >>>>> CString is just typedef to CObjectSimple and the used constructor calls >>>>> utils::simpleValueFromXpdfObj. >>>>> >>>>> src/kernel $ grep simpleValueFromXpdfObj -I * >>>>> cobject2string.cc: simpleValueFromXpdfObj (*ptrObj, val); >>>>> cobject2xpdf.cc:simpleValueFromXpdfObj (const Object& obj, T val) >>>>> cobject2xpdf.cc:simpleValueFromXpdfObj (const Object&, NullType&) >>>>> cobjectsimple.h:template void simpleValueFromXpdfObj (const ::Object& obj, T val); >>>>> cobjectsimpleI.h: utils::simpleValueFromXpdfObj (o,value); >>>>> cobjectsimpleI.h: utils::simpleValueFromXpdfObj (o,value); >>>>> >>>>> This means that the only definition of this template function is in cc >>>>> module and not in header file. I thought that this is not correct wrt. >>>>> to the current state of C++ compilers. I am also wondering why other >>>>> constructors (e.g. CReal) are not any problem... When I comment out >>>>> the offending line I don't get linkage error. >>>>> How should we address this? >>>> >>>> explicit template specialization. >>> >>> Little bit to generic to me... What should be specialized? CString >>> constructor or simpleValueFromXpdfObj? Patch would be welcome ;) >> >> to remedy this specific error try to add this line after the definition of simpleValueFromXpdfObj >> >> >> template void simpleValueFromXpdfObj (const Object& obj, std::string& val); >> >> >> does it help? > > Yes, That did the trick. Thanks. Could you review the attached patch (I > would like to make it as descriptive as possible if something similar > pops out later). > > Btw. why other types have no problem? Should we add specialized > declaration as well? we can just to be sure. this is probably gcc bug. /jozo > >> >> >> more about specialization can be found e.g. >> http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=/com.ibm.xlcpp8a.doc/language/ref/explicit_specialization.htm >> >> >> >> /jm >> >> >>> >>>> >>>> can you try it as i am not getting these errors. >>>> >>>> /jm >>>> >>>> >>>>> -- >>>>> Michal Hocko >>>> _________________________________________________________________ >>>> Hotmail: Free, trusted and rich email service. >>>> http://clk.atdmt.com/GBL/go/171222984/direct/01/ >>> >>> -- >>> Michal Hocko >> _________________________________________________________________ >> Hotmail: Powerful Free email with security by Microsoft. >> http://clk.atdmt.com/GBL/go/171222986/direct/01/ > > -- > Michal Hocko _________________________________________________________________ Hotmail: Free, trusted and rich email service. http://clk.atdmt.com/GBL/go/171222984/direct/01/ |
From: Michal H. <ms...@gm...> - 2009-09-15 14:52:12
|
On Tue, Sep 15, 2009 at 04:04:49PM +0200, Michal Hocko wrote: > On Tue, Sep 15, 2009 at 01:27:02PM +0000, Jozef Misutka wrote: > > > On Tue, Sep 15, 2009 at 10:03:32AM +0000, Jozef Misutka wrote: > > >>> > > >>> Hi Jozo, > > >>> I have started having problems to link test with g++-4.3 because of: > > >>> testcobjectsimple.cc:(.text._ZN10pdfobjects13CObjectSimpleILNS_12PropertyTypeE3EEC1EN5boost8weak_ptrINS_4CPdfEEERK6ObjectRKNS_7IndiRefE[pdfobjects::CObjectSimple::CObjectSimple(boost::weak_ptr, Object const&, pdfobjects::IndiRef const&)]+0x6f): undefined reference to `void pdfobjects::utils::simpleValueFromXpdfObj&>(Object const&, std::basic_string, std::allocator>&)' > > >>> collect2: ld returned 1 exit status > > >>> > > >>> Strangely enough this doesn't happen if I compile with g++-4.1 (I > > >>> haven't tried other versions yet). > > >>> > > >>> AFAIU, the problem is that > > >>> simpleValueFromXpdfObj(const Object&, string&) is > > >>> not defined and it is required by: > > >>> testcobjectsimple.cc: > > >>> 131 CString s (pdf,obj,ref); > > >>> > > >>> CString is just typedef to CObjectSimple and the used constructor calls > > >>> utils::simpleValueFromXpdfObj. > > >>> > > >>> src/kernel $ grep simpleValueFromXpdfObj -I * > > >>> cobject2string.cc: simpleValueFromXpdfObj (*ptrObj, val); > > >>> cobject2xpdf.cc:simpleValueFromXpdfObj (const Object& obj, T val) > > >>> cobject2xpdf.cc:simpleValueFromXpdfObj (const Object&, NullType&) > > >>> cobjectsimple.h:template void simpleValueFromXpdfObj (const ::Object& obj, T val); > > >>> cobjectsimpleI.h: utils::simpleValueFromXpdfObj (o,value); > > >>> cobjectsimpleI.h: utils::simpleValueFromXpdfObj (o,value); > > >>> > > >>> This means that the only definition of this template function is in cc > > >>> module and not in header file. I thought that this is not correct wrt. > > >>> to the current state of C++ compilers. I am also wondering why other > > >>> constructors (e.g. CReal) are not any problem... When I comment out > > >>> the offending line I don't get linkage error. > > >>> How should we address this? > > >> > > >> explicit template specialization. > > > > > > Little bit to generic to me... What should be specialized? CString > > > constructor or simpleValueFromXpdfObj? Patch would be welcome ;) > > > > to remedy this specific error try to add this line after the definition of simpleValueFromXpdfObj > > > > > > template void simpleValueFromXpdfObj (const Object& obj, std::string& val); > > > > > > does it help? > > Yes, That did the trick. Ups it didn't. I have forgot to change the compiler back to 4.3. I have tried both variants in kernel/cobject2xpdf.cc: template<> void simpleValueFromXpdfObj<pString, std::string&> (const Object& obj, std::string& val); and void simpleValueFromXpdfObj (const Object& obj, std::string& val); But non of them helped. Btw. gcc 4.4.1 produces the same error. > Thanks. Could you review the attached patch (I > would like to make it as descriptive as possible if something similar > pops out later). > > Btw. why other types have no problem? Should we add specialized > declaration as well? > > > > > > > more about specialization can be found e.g. > > http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=/com.ibm.xlcpp8a.doc/language/ref/explicit_specialization.htm > > > > > > > > /jm > > > > > > > > > >> > > >> can you try it as i am not getting these errors. > > >> > > >> /jm > > >> > > >> > > >>> -- > > >>> Michal Hocko > > >> _________________________________________________________________ > > >> Hotmail: Free, trusted and rich email service. > > >> http://clk.atdmt.com/GBL/go/171222984/direct/01/ > > > > > > -- > > > Michal Hocko > > _________________________________________________________________ > > Hotmail: Powerful Free email with security by Microsoft. > > http://clk.atdmt.com/GBL/go/171222986/direct/01/ > > -- > Michal Hocko > kernel: simpleValueFromXpdfObj specification for pString > > gcc 4.3.4 (I haven't checked 4.2 nor other 4.3.x version) doesn't link tests > correctly and complains that simpleValueFromXpdfObj for pString is missing: > testcobjectsimple.cc:(.text._ZN10pdfobjects13CObjectSimpleILNS_12PropertyTypeE3EEC1EN5boost8weak_ptrINS_4CPdfEEERK6ObjectRKNS_7IndiRefE[pdfobjects::CObje > +ctSimple<(pdfobjects::PropertyType)3>::CObjectSimple(boost::weak_ptr<pdfobjects::CPdf>, Object const&, pdfobjects::IndiRef const&)]+0x6f): undefined > +reference to `void pdfobjects::utils::simpleValueFromXpdfObj<(pdfobjects::PropertyType)3, std::basic_string<char, std::char_traits<char>, > +std::allocator<char> >&>(Object const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)' > collect2: ld returned 1 exit status > > Strangely enough this doesn't happen if I compile with g++-4.1 (I > haven't tried other versions yet). > > AFAIU, the problem is that > simpleValueFromXpdfObj<pString, std::string&>(const Object&, string&) is > not defined and it is required by: > testcobjectsimple.cc: > 131 CString s (pdf,obj,ref); > > CString is just typedef to CObjectSimple<pString> and the used constructor calls > utils::simpleValueFromXpdfObj<pString, string&>. > > src/kernel $ grep simpleValueFromXpdfObj -I * > cobject2string.cc: simpleValueFromXpdfObj<pReal, double&> (*ptrObj, val); > cobject2xpdf.cc:simpleValueFromXpdfObj (const Object& obj, T val) > cobject2xpdf.cc:simpleValueFromXpdfObj<pNull,NullType&> (const Object&, NullType&) > cobjectsimple.h:template <PropertyType Tp,typename T> void simpleValueFromXpdfObj (const ::Object& obj, T val); > cobjectsimpleI.h: utils::simpleValueFromXpdfObj<Tp,Value&> (o,value); > cobjectsimpleI.h: utils::simpleValueFromXpdfObj<Tp,Value&> (o,value); > > This means that the only definition of this template function is in cc > module and not in header file. I thought that this is not correct wrt. > to the current state of C++ compilers. > > Accoring to Jozo we should address this by the template specialization so > we should add simpleValueFromXpdfObj variant with the pString parameters > explicitly. > Index: pdfedit-patches/src/kernel/cobject2xpdf.cc > =================================================================== > --- pdfedit-patches.orig/src/kernel/cobject2xpdf.cc 2009-09-15 13:18:50.000000000 +0200 > +++ pdfedit-patches/src/kernel/cobject2xpdf.cc 2009-09-15 15:57:44.000000000 +0200 > @@ -728,6 +728,8 @@ simpleValueFromXpdfObj<pNull,NullType&> > /*assert (!"operation not permitted...");*//*THIS IS FORBIDDEN IN THE CALLER*/ > } > > +// Special case for pString which is required for proper linkage by gcc 4.3.4 > +void simpleValueFromXpdfObj (const Object& obj, std::string& val); > > // > // > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9-12, 2009. Register now! > http://p.sf.net/sfu/devconf > _______________________________________________ > Pdfedit-devel mailing list > Pdf...@li... > https://lists.sourceforge.net/lists/listinfo/pdfedit-devel -- Michal Hocko |
From: Michal H. <ms...@gm...> - 2009-09-15 14:57:08
|
On Tue, Sep 15, 2009 at 04:52:01PM +0200, Michal Hocko wrote: > On Tue, Sep 15, 2009 at 04:04:49PM +0200, Michal Hocko wrote: > > On Tue, Sep 15, 2009 at 01:27:02PM +0000, Jozef Misutka wrote: > > > > On Tue, Sep 15, 2009 at 10:03:32AM +0000, Jozef Misutka wrote: [...] > > > >>> How should we address this? > > > >> > > > >> explicit template specialization. > > > > > > > > Little bit to generic to me... What should be specialized? CString > > > > constructor or simpleValueFromXpdfObj? Patch would be welcome ;) > > > > > > to remedy this specific error try to add this line after the definition of simpleValueFromXpdfObj > > > > > > > > > template void simpleValueFromXpdfObj (const Object& obj, std::string& val); > > > > > > > > > does it help? > > > > Yes, That did the trick. > > Ups it didn't. I have forgot to change the compiler back to 4.3. > > I have tried both variants in kernel/cobject2xpdf.cc: > template<> void simpleValueFromXpdfObj<pString, std::string&> (const Object& obj, std::string& val); > and > void simpleValueFromXpdfObj (const Object& obj, std::string& val); > > But non of them helped. > > Btw. gcc 4.4.1 produces the same error. There is some change wrt. 4.3.4 though. If I use the template<> variant I am getting also one more linkage error for cobject2xpdf.cc: cobject2xpdf.cc:(.text._ZN10pdfobjects13CObjectSimpleILNS_12PropertyTypeE3EEC1ERK6Object[pdfobjects::CObjectSimple<(pdfobjects::PropertyType)3>::CObjectSimple(Object const&)]+0x79): undefined reference to `void pdfobjects::utils::simpleValueFromXpdfObj<(pdfobjects::PropertyType)3, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(Object const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)' This error is not present in the later variant. -- Michal Hocko |
From: Michal H. <ms...@gm...> - 2009-09-15 17:16:22
Attachments:
test.tar.gz
|
I have tried to extract the core constructs as they are implemented in our project and I have the same problem with linking. What I consider surprising is that I have the same linkage error with 4.1 gcc as well. Short description: object.h - Object class definition cobject.h - cobjectsimple.h cobjectsimpleI.h counterparts cobject.cc - cobject2xpdf.cc counterpart main.cc - CString usage Jozo, could you look at it and confirm that the example fit our usage? -- Michal Hocko |
From: Michal H. <ms...@gm...> - 2009-10-06 10:09:25
|
On Tue, Sep 15, 2009 at 11:04:01AM +0200, Michal Hocko wrote: > Hi Jozo, > I have started having problems to link test with g++-4.3 because of: > testcobjectsimple.cc:(.text._ZN10pdfobjects13CObjectSimpleILNS_12PropertyTypeE3EEC1EN5boost8weak_ptrINS_4CPdfEEERK6ObjectRKNS_7IndiRefE[pdfobjects::CObjectSimple<(pdfobjects::PropertyType)3>::CObjectSimple(boost::weak_ptr<pdfobjects::CPdf>, Object const&, pdfobjects::IndiRef const&)]+0x6f): undefined reference to `void pdfobjects::utils::simpleValueFromXpdfObj<(pdfobjects::PropertyType)3, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(Object const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)' > collect2: ld returned 1 exit status > > Strangely enough this doesn't happen if I compile with g++-4.1 (I > haven't tried other versions yet). > > AFAIU, the problem is that > simpleValueFromXpdfObj<pString, std::string&>(const Object&, string&) is > not defined and it is required by: > testcobjectsimple.cc: > 131 CString s (pdf,obj,ref); > > CString is just typedef to CObjectSimple<pString> and the used constructor calls > utils::simpleValueFromXpdfObj<pString, string&>. > > src/kernel $ grep simpleValueFromXpdfObj -I * > cobject2string.cc: simpleValueFromXpdfObj<pReal, double&> (*ptrObj, val); > cobject2xpdf.cc:simpleValueFromXpdfObj (const Object& obj, T val) > cobject2xpdf.cc:simpleValueFromXpdfObj<pNull,NullType&> (const Object&, NullType&) > cobjectsimple.h:template <PropertyType Tp,typename T> void simpleValueFromXpdfObj (const ::Object& obj, T val); > cobjectsimpleI.h: utils::simpleValueFromXpdfObj<Tp,Value&> (o,value); > cobjectsimpleI.h: utils::simpleValueFromXpdfObj<Tp,Value&> (o,value); > > This means that the only definition of this template function is in cc > module and not in header file. I thought that this is not correct wrt. > to the current state of C++ compilers. I am also wondering why other > constructors (e.g. CReal) are not any problem... When I comment out > the offending line I don't get linkage error. > How should we address this? Hmm, it looks like the problem is gone. Without any code modifications. I rememeber there was some gcc update recently so maybe this was just a bug. I cannot see anything obvious in the changelog, though. The code now compiles and links by 4.1.3 (20080704), 4.3.4 and 4.4.1 without any problems. -- Michal Hocko |