Gary Popov wrote:
> Hi guys, I recently compiled both libpq and libpqxx (as per 
> instructions) and it seems that everything was successful - I got a 
> folder full of .lib and .dlls files, all of the tests compiled okay 
> and then when I went to compile a really tiny test program, I got errors.
>
> #include <pqxx/connection.hxx>
> #include <pqxx/transactor.hxx>
>
> int main()
> {
>     pqxx::connection con("connection info was here");
>     pqxx::work test(con, "test");
>    
>     pqxx::result r =  test.exec("SELECT * FROM pg_user");
> }
>
> Linker options (as seen from within MSVC8.0's linker tab..)
>
> /OUT:"E:\test\Debug\test.exe" /INCREMENTAL /NOLOGO /MANIFEST 
> /MANIFESTFILE:"Debug\test.exe.intermediate.manifest" /DEBUG 
> /PDB:"e:\test\debug\test.pdb" /SUBSYSTEM:CONSOLE /MACHINE:X86 
> /ERRORREPORT:PROMPT libpqxx.lib  kernel32.lib user32.lib gdi32.lib 
> winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib 
> oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
>
> and the linker error is..
>
> ------ Build started: Project: test, Configuration: Debug Win32 ------
> Linking...
> libpqxx_staticD.lib(util.obj) : error LNK2005: "public: __thiscall 
> pqxx::internal::refcount::~refcount(void)" 
> ([EMAIL PROTECTED]@pqxx@@[EMAIL PROTECTED]) already defined in 
> libpqxx.lib(libpqxx.dll)
> libpqxx_staticD.lib(util.obj) : error LNK2005: "public: bool 
> __thiscall pqxx::internal::refcount::loseref(void)" 
> ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@QAE_NXZ) already defined in 
> libpqxx.lib(libpqxx.dll)
> E:\test\Debug\test.exe : fatal error LNK1169: one or more multiply 
> defined symbols found
> Build log was saved at "file://e:\test\test\Debug\BuildLog.htm 
> <file://e:%5Ctest%5Ctest%5CDebug%5CBuildLog.htm>"
> test - 3 error(s), 0 warning(s)
> ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped 
> ==========
>
> so... I'm wondering if I did something wrong? I recall fidling with 
> the header files a bit (uh-oh), but I don't remember 100% what I did. 
> I think I changed all of the instances of disable_noticer from 
> pqxx::internal::disable_noticer to just pqxx::disable_noticer, but I 
> don't see how this would have any impact... or would it?

It looks like you're linking to both the static (LIB) and the dynamic 
(DLL + import LIB) version of libpqxx. Remove one of the two -- and I 
suggest that you remove libpqxx.lib. I seem to remember that a library 
is selected and linked automatically by the libpqxx headers based on 
#defines, so you probably added one library yourself in the linker 
settings, while the other one comes from the libpqxx headers. I suggest 
you remove the one from your linker settings, and adjust your additional 
#defines to indicate the library that you want (which is definitely the 
static one!).

Cheers,
Bart
_______________________________________________
Libpqxx-general mailing list
[EMAIL PROTECTED]
http://gborg.postgresql.org/mailman/listinfo/libpqxx-general

Reply via email to