[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 733
  • Last Modified:

Visual studio 2005: Getting the libpqxx wrapper for the PostgreSQL API to compile for windows development

I'm attempting to get the libpqxx C++ wrapper for the PostgreSQL  libpq C API to compile for windows development. As is sometimes the case with free software, documentation is a little sparse and windows support is sub-optimal. According to the documentation, compilation with MinGW and MSYS is preferable.

I wondered, would it be possible to compile the libpqxx wrapper using this environment (MinGW and MSYS), and then dynamically link to its compiled dll in visual studio, or would it be necessary to build in the same environment that the dlls will be linked to?

Regards,
Sternocera
0
sternocera
Asked:
sternocera
1 Solution
 
jkrCommented:
DLLs themselves can be used with either configuration, so the environment should not matter directly (caveat: you might have to install runtime DLLs that the respective build environment requires). What problems are you facing?
0
 
sternoceraAuthor Commented:
I'm not facing any specific problem as of yet. I just wanted to ensure that it was in fact possible to build the dll using MinGW and MSYS and dynamically lnk my visual C++ 2005 project to that dll, before actually undertaking to do so.

Thanks
0
 
jkrCommented:
Yes, that is well possible. As above, all you need to make sure is that if there are any runtime DLLs required by either compiler, you will have to install these along with the wrapper DLL, so that no missing dependencies will cause any problems. You can always use the Dependency Walker (www.dependencywalker.com) to ensure nothing is missing.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
sternoceraAuthor Commented:
Thank you.
0
 
sternoceraAuthor Commented:
Tried that. This configuration:

# This directory is also used to find the compiled libpq and libpqd.
PGSQLSRC=C:\postgresql-8.1.9\src

# Paths where the libpq library binary or binaries can be found.
# We should use the libpq libraries that correspond to the source tree whose
# headers we are including.  This ensures that we find all in the same place:
LIBPATH1="$(PGSQLSRC)\interfaces\libpq\Release"
LIBPATH2="$(PGSQLSRC)\interfaces\libpq\Release"

gives this output:
# This directory is also used to find the compiled libpq and libpqd.
PGSQLSRC=C:\postgresql-8.1.9\src

# Paths where the libpq library binary or binaries can be found.
# We should use the libpq libraries that correspond to the source tree whose
# headers we are including.  This ensures that we find all in the same place:
LIBPATH1=$(PGSQLSRC)\interfaces\libpq\Release
LIBPATH2=$(PGSQLSRC)\interfaces\libpq\Release

This configuration:
# This directory is also used to find the compiled libpq and libpqd.
PGSQLSRC=C:\postgresql-8.1.9\src

# Paths where the libpq library binary or binaries can be found.
# We should use the libpq libraries that correspond to the source tree whose
# headers we are including.  This ensures that we find all in the same place:
LIBPATH1=$(PGSQLSRC)\interfaces\libpq\Release
LIBPATH2=$(PGSQLSRC)\interfaces\libpq\Release

Gives this output:
Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
Copyright (C) Microsoft Corporation.  All rights reserved.

        cl.exe /nologo /W3 /GX /FD /GR /c  /I "include" /I C:\postgresql-8.1.9\s
rc/include /I C:\postgresql-8.1.9\src/interfaces/libpq  /D PGSTD="std" /D "WIN32
" /D "_MBCS" /D "_WINDOWS" /D "PQXX_INTERNAL" /MDd /Gm /ZI /Od /D "_LIB" /D "_DE
BUG" /GZ /Fo"ObjStaticDebug\\" /Fd"ObjStaticDebug\\" src/connection_base.cxx
cl : Command line warning D9035 : option 'GX' has been deprecated and will be re
moved in a future release
cl : Command line warning D9036 : use 'EHsc' instead of 'GX'
cl : Command line warning D9035 : option 'GZ' has been deprecated and will be re
moved in a future release
cl : Command line warning D9036 : use 'RTC1' instead of 'GZ'
connection_base.cxx
c:\libpqxx-2.6.9\include\pqxx\trigger.hxx(70) : error C2039: 'disable_noticer' :
 is not a member of 'pqxx::internal'
c:\libpqxx-2.6.9\src\connection_base.cxx(117) : warning C4351: new behavior: ele
ments of array 'pqxx::connection_base::m_caps' will be default initialized
NMAKE : fatal error U1077: '"c:\Program Files\Microsoft Visual Studio 8\VC\BIN\c
l.exe"' : return code '0x2'
Stop.

Do you suppose it has something to do with mixing windows style "\"s with unix style "/"s?


0
 
jkrCommented:
Wrong question? ;o)

>>Do you suppose it has something to do with mixing windows style "\"s with
>>unix style "/"s?

No, VC++ can handle both.
0
 
jsbsudhaCommented:
where is the solution for this.........I am also getting the same problem........
0
 
threadyCommented:
Hi guys, old thread, I hope you can remember how you got it working if you did..  Did you use MinGW and MSYS ?

Thanks!
Mike
0

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now