Ticket #134 (reopened defect)

Opened 2 years ago

Last modified 5 months ago

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.

Attachments

Change History

Changed 2 years ago by anonymous

  • status changed from new to closed
  • resolution set to fixed

There was no problem in the libraries or anything, just Project Settings in Visual Studio. In the 'Code Generation' (under C++) property of the project, set to Multi-threaded Debug DLL (/MDd) and this specific error should go away.

Changed 5 months ago by anonymous

  • cc rajeshbabue@… added
  • status changed from closed to reopened
  • resolution fixed deleted
  • milestone changed from 2.6.9 to 3.1

Changed 5 months ago by rajeshbabue@…

  • cc rajeshbabue@… removed

I'm getting the same problem with 8.4 version of PostgreSQL

Add/Change #134 (libpqxx projects compiling from the visual studio IDE)

Author


E-mail address and user name can be saved in the Preferences.


Change Properties
<Author field>
Action
as reopened
as The resolution will be set. Next status will be 'closed'
to The owner will change from jtv. Next status will be 'new'
 
Note: See TracTickets for help on using tickets.