Re: Troubles linking with libpqxx

From: "Sandeep Kumar Jakkaraju" <sandeepkumar(dot)jakkaraju(at)gmail(dot)com>
To: Eric <erousset(at)nospam-gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Troubles linking with libpqxx
Date: 2006-08-18 04:31:49
Message-ID: c653c98f0608172131j1dbe9bf2q68c880720ff3671c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Eric

Check your Runtime Library( MultiThreaded Debug Dll etc) and Struct member
alignment !!!

They should be same as what you used to compile libpq

Regards
sandeep

On 8/16/06, Eric <erousset(at)nospam-gmail(dot)com> wrote:
>
> Hi,
> I'm trying to compile the test001.cxx sample included in the
> libpqxx-2.6.7 package, but I get the following linking errors from
> Visual Studio .Net 2003:
>
> ------ Build started: Project: PostGreSample, Configuration: Release
> Win32 ------
>
> Linking...
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: __thiscall
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> >::~basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> >(void)"
> (??1?$basic_string(at)DU?$char_traits@D(at)std@@V?$allocator(at)D@2@@std@@QAE(at)XZ)
> already defined in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: __thiscall
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> >::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> >(char const *)"
> (??0?$basic_string(at)DU?$char_traits@D(at)std@@V?$allocator(at)D@2@@std@@QAE(at)PBD
> @Z)
> already defined in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: __thiscall
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> >::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> >(class
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> > const &)"
> (??0?$basic_string(at)DU?$char_traits@D(at)std@@V?$allocator(at)D@2@@std@@QAE(at)ABV01
> @@Z)
> already defined in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: char const *
> __thiscall std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> >::c_str(void)const "
> (?c_str(at)?$basic_string@DU?$char_traits(at)D@std@@V?$allocator(at)D
> @2@@std@@QBEPBDXZ)
> already defined in libcp.lib(locale0.obj)
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: __thiscall
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> >::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> >(void)"
> (??0?$basic_string(at)DU?$char_traits@D(at)std@@V?$allocator(at)D@2@@std@@QAE(at)XZ)
> already defined in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: class
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> > & __thiscall std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> >::operator=(char
> const *)"
> (??4?$basic_string(at)DU?$char_traits@D(at)std@@V?$allocator(at)D@2@@std@@
> QAEAAV01(at)PBD@Z)
> already defined in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: class
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> > & __thiscall std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> >::assign(char const
> *,unsigned int)"
> (?assign(at)?$basic_string@DU?$char_traits(at)D@std@@V?$allocator(at)D@2@@std@@
> QAEAAV12(at)PBDI@Z)
> already defined in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: unsigned int
> __thiscall std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> >::size(void)const "
> (?size(at)?$basic_string@DU?$char_traits(at)D@std@@V?$allocator(at)D
> @2@@std@@QBEIXZ)
> already defined in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: __thiscall
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> >::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> >(unsigned int,char)"
> (??0?$basic_string(at)DU?$char_traits@D(at)std@@V?$allocator(at)D@2@@std@@QAE(at)ID@Z)
> already defined in libcp.lib(cerr.obj)
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: int __thiscall
> std::ios_base::width(int)" (?width(at)ios_base@std@@QAEHH(at)Z) already
> defined in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: void __thiscall
> std::basic_ios<char,struct std::char_traits<char> >::setstate(int,bool)"
> (?setstate(at)?$basic_ios@DU?$char_traits(at)D@std@@@std@@QAEXH_N(at)Z) already
> defined in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: class
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> > & __thiscall std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> >::append(unsigned
> int,char)"
> (?append(at)?$basic_string@DU?$char_traits(at)D@std@@V?$allocator(at)D@2@@std@@
> QAEAAV12(at)ID@Z)
> already defined in libcp.lib(cerr.obj)
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: static bool __cdecl
> std::char_traits<char>::eq_int_type(int const &,int const &)"
> (?eq_int_type(at)?$char_traits@D(at)std@@SA_NABH0(at)Z) already defined in
> test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: static int __cdecl
> std::char_traits<char>::eof(void)" (?eof(at)?$char_traits@D(at)std@@SAHXZ)
> already defined in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: class
> std::basic_streambuf<char,struct std::char_traits<char> > * __thiscall
> std::basic_ios<char,struct std::char_traits<char> >::rdbuf(void)const "
> (?rdbuf(at)?$basic_ios@DU?$char_traits(at)D@std@@@std@@
> QBEPAV?$basic_streambuf(at)DU?$char_traits@D(at)std@@@2(at)XZ)
> already defined in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: unsigned int
> __thiscall std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> >::max_size(void)const "
> (?max_size(at)?$basic_string@DU?$char_traits(at)D@std@@V?$allocator(at)D
> @2@@std@@QBEIXZ)
> already defined in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: int __thiscall
> std::ios_base::width(void)const " (?width(at)ios_base@std@@QBEHXZ) already
> defined in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: class
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> > & __thiscall std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> >::erase(unsigned
> int,unsigned int)"
> (?erase(at)?$basic_string@DU?$char_traits(at)D@std@@V?$allocator(at)D@2@@std@@
> QAEAAV12(at)II@Z)
> already defined in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: __thiscall
> std::locale::~locale(void)" (??1locale(at)std@@QAE(at)XZ) already defined in
> libcp.lib(ios.obj)
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: class std::locale
> __thiscall std::ios_base::getloc(void)const "
> (?getloc(at)ios_base@std@@QBE?AVlocale(at)2@XZ) already defined in
> libcp.lib(cerr.obj)
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: void __thiscall
> std::basic_streambuf<char,struct std::char_traits<char>
> >::_Unlock(void)"
> (?_Unlock(at)?$basic_streambuf@DU?$char_traits(at)D@std@@@std@@QAEXXZ) already
> defined in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: void __thiscall
> std::basic_streambuf<char,struct std::char_traits<char> >::_Lock(void)"
> (?_Lock(at)?$basic_streambuf@DU?$char_traits(at)D@std@@@std@@QAEXXZ) already
> defined in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: __thiscall
> std::_Lockit::~_Lockit(void)" (??1_Lockit(at)std@@QAE(at)XZ) already defined
> in libcp.lib(ios.obj)
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: void __thiscall
> std::locale::facet::_Register(void)"
> (?_Register(at)facet@locale(at)std@@QAEXXZ) already defined in
> libcp.lib(locale0.obj)
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: void __thiscall
> std::locale::facet::_Incref(void)" (?_Incref(at)facet@locale(at)std@@QAEXXZ)
> already defined in libcp.lib(ios.obj)
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: static unsigned int
> __cdecl std::ctype<char>::_Getcat(class std::locale::facet const * *)"
> (?_Getcat(at)?$ctype@D(at)std@@SAIPAPBVfacet(at)locale@2@@Z) already defined in
> libcp.lib(cerr.obj)
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: class
> std::locale::facet const * __thiscall std::locale::_Getfacet(unsigned
> int)const " (?_Getfacet(at)locale@std@@QBEPBVfacet(at)12@I(at)Z) already defined
> in libcp.lib(locale0.obj)
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: __thiscall
> std::locale::id::operator unsigned int(void)" (??Bid(at)locale@std@@QAEIXZ)
> already defined in libcp.lib(cerr.obj)
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: __thiscall
> std::_Lockit::_Lockit(int)" (??0_Lockit(at)std@@QAE(at)H@Z) already defined in
> libcp.lib(ios.obj)
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: char __thiscall
> std::basic_ios<char,struct std::char_traits<char> >::widen(char)const "
> (?widen(at)?$basic_ios@DU?$char_traits(at)D@std@@@std@@QBEDD(at)Z) already
> defined in libcp.lib(cerr.obj)
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: static int __cdecl
> std::char_traits<char>::to_int_type(char const &)"
> (?to_int_type(at)?$char_traits@D(at)std@@SAHABD(at)Z) already defined in
> test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: char const &
> __thiscall std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> >::operator[](unsigned int)const "
> (??A?$basic_string(at)DU?$char_traits@D(at)std@@V?$allocator(at)D@2@@std@@QBEABDI(at)Z
> )
> already defined in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: int __thiscall
> std::basic_streambuf<char,struct std::char_traits<char> >::sputc(char)"
> (?sputc(at)?$basic_streambuf@DU?$char_traits(at)D@std@@@std@@QAEHD(at)Z) already
> defined in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: char __thiscall
> std::basic_ios<char,struct std::char_traits<char> >::fill(void)const "
> (?fill(at)?$basic_ios@DU?$char_traits(at)D@std@@@std@@QBEDXZ) already defined
> in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: int __thiscall
> std::ios_base::flags(void)const " (?flags(at)ios_base@std@@QBEHXZ) already
> defined in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: class
> std::basic_ostream<char,struct std::char_traits<char> > & __thiscall
> std::basic_ostream<char,struct std::char_traits<char> >::flush(void)"
> (?flush(at)?$basic_ostream@DU?$char_traits(at)D@std@@@std@@QAEAAV12(at)XZ)
> already defined in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: class
> std::basic_ostream<char,struct std::char_traits<char> > * __thiscall
> std::basic_ios<char,struct std::char_traits<char> >::tie(void)const "
> (?tie(at)?$basic_ios@DU?$char_traits(at)D@std@@@std@@QBEPAV?$basic_ostream(at)DU
> ?$char_traits(at)D@std@@@2(at)XZ)
> already defined in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: bool __thiscall
> std::ios_base::good(void)const " (?good(at)ios_base@std@@QBE_NXZ) already
> defined in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: void __thiscall
> std::basic_ostream<char,struct std::char_traits<char> >::_Osfx(void)"
> (?_Osfx(at)?$basic_ostream@DU?$char_traits(at)D@std@@@std@@QAEXXZ) already
> defined in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "bool __cdecl
> std::uncaught_exception(void)" (?uncaught_exception(at)std@@YA_NXZ) already
> defined in libcp.lib(uncaught.obj)
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: class
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> > & __thiscall std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> >::operator=(class
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> > const &)"
> (??4?$basic_string(at)DU?$char_traits@D(at)std@@V?$allocator(at)D@2@@std@@
> QAEAAV01(at)ABV01@@Z)
> already defined in test001.obj
> msvcprt.lib(MSVCP71.dll) : error LNK2005: "class
> std::basic_ostream<char,struct std::char_traits<char> > & __cdecl
> std::operator<<<struct std::char_traits<char> >(class
> std::basic_ostream<char,struct std::char_traits<char> > &,char const *)"
> (??$?6U?$char_traits(at)D@std@@@std@@YAAAV?$basic_ostream(at)DU?$char_traits@
> D(at)std@@@0(at)AAV10@PBD(at)Z)
> already defined in test001.obj
> MSVCRT.lib(MSVCR71.dll) : error LNK2005: "public: virtual __thiscall
> exception::~exception(void)" (??1exception@@UAE(at)XZ) already defined in
> LIBC.lib(stdexcpt.obj)
> MSVCRT.lib(MSVCR71.dll) : error LNK2005: "public: __thiscall
> exception::exception(void)" (??0exception@@QAE(at)XZ) already defined in
> LIBC.lib(stdexcpt.obj)
> MSVCRT.lib(MSVCR71.dll) : error LNK2005: "public: __thiscall
> exception::exception(class exception const &)"
> (??0exception@@QAE(at)ABV0@@Z) already defined in LIBC.lib(stdexcpt.obj)
> MSVCRT.lib(MSVCR71.dll) : error LNK2005: _strncpy already defined in
> LIBC.lib(strncpy.obj)
> MSVCRT.lib(MSVCR71.dll) : error LNK2005: "public: __thiscall
> bad_cast::bad_cast(char const *)" (??0bad_cast@@QAE(at)PBD@Z) already
> defined in LIBC.lib(stdexcpt.obj)
> MSVCRT.lib(MSVCR71.dll) : error LNK2005: "public: __thiscall
> exception::exception(char const * const &)" (??0exception@@QAE(at)ABQBD@Z)
> already defined in LIBC.lib(stdexcpt.obj)
> MSVCRT.lib(MSVCR71.dll) : error LNK2005: _atoi already defined in
> LIBC.lib(atox.obj)
> MSVCRT.lib(MSVCR71.dll) : error LNK2005: _memmove already defined in
> LIBC.lib(memmove.obj)
> MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall
> type_info::type_info(class type_info const &)"
> (??0type_info@@AAE(at)ABV0@@Z) already defined in LIBC.lib(typinfo.obj)
> MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info &
> __thiscall type_info::operator=(class type_info const &)"
> (??4type_info@@AAEAAV0(at)ABV0@@Z) already defined in LIBC.lib(typinfo.obj)
> LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other
> libs; use /NODEFAULTLIB:library
> libpqxx_static.lib(connection_base.obj) : error LNK2019: unresolved
> external symbol __imp__select(at)20 referenced in function $L84816
> Release/PostGreSample.exe : fatal error LNK1120: 1 unresolved externals
>
> Build log was saved at "file://c:\Documents and Settings\eric\Mes
> documents\Visual Studio Projects\PostGreSample\Release\BuildLog.htm"
> PostGreSample - 54 error(s), 1 warning(s)
>
>
> ---------------------- Done ----------------------
>
> Build: 0 succeeded, 1 failed, 0 skipped
>
>
> I'm using the .lib binaries which I compiled from the sources (same for
> libpq.lib).
> Thanks by advance,
> Eric
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message macieh 2006-08-18 07:25:31 External variable
Previous Message Daniel Staal 2006-08-18 01:51:00 Re: [GENERAL] DB insert Error