Ticket #134 (reopened defect)
libpqxx projects compiling from the visual studio IDE
| Reported by: | shah.taimoor@… | Owned by: | jtv |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.1 |
| Component: | portability | Version: | 2.6 |
| Severity: | normal | Keywords: | VC, Visual studio, win32, already defined in |
| Cc: |
Description
I am having the exact same problem Peter reported in Ticket #121. I am trying to get the example given in README file to work. Just to summarize, in a new project in Visual Studio IDE, I added the additional 'include' directories, which allows the file to compile OK. As for the linking - as Peter wrote:
* Under Linker::General::Additional Library directories, I have placed "C:\Apps\Postgres\postgresql-8.3.0\src\interfaces\libpq\Debug";"C:\Apps\Postgres\libpqxx-2.6.9\lib" for the Debug and ""C:\Apps\Postgres\postgresql-8.3.0\src\interfaces\libpq\Release";"C:\Apps\Postgres\libpqxx-2.6.9\lib"" for the Release.
But as the solution suggests:
* Under Linker::Input::Additional Dependencies, I have placed "libpqxx_static.lib wsock32.lib" for all configurations.
Nothing more, nothing less. But I still get the linking errors:
=====================================================================
Libpqxx-App 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@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in Libpqxx-App.obj
Libpqxx-App 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@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in Libpqxx-App.obj
Libpqxx-App 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@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) already defined in Libpqxx-App.obj
Libpqxx-App 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@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) already defined in Libpqxx-App.obj
<...About twenty more similar complaints.... >
Libpqxx-App 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@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBDI@Z) already defined in Libpqxx-App.obj Libpqxx-App fatal error LNK1104: cannot open file 'libpqdll.lib'
From the project properties I can see that my command line for linker looks like:
/OUT:"Debug/Libpqxx-App.exe" /INCREMENTAL /NOLOGO /LIBPATH:"C:\Apps\Postgres\postgresql-8.3.0\src\interfaces\libpq\Debug" /LIBPATH:"C:\Apps\Postgres\libpqxx-2.6.9\lib" /DEBUG /PDB:"Debug/Libpqxx-App.pdb" /SUBSYSTEM:CONSOLE /MACHINE:X86 libpqxx_static.lib wsock32.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 "\Apps\Postgres\libpqxx-2.6.9\lib\libpqxx_static.lib"
Any hint in the right direction would be greatly appreciated as it is getting really frustrating.
