Question

I'm writing an application that links all 3rd party code via static libraries (including tinyxml2, sqlite3, openssl and libpq); everything is working fine beyond whenever I try to link to libpqd.lib - having used the 9.1.9 and 9.2.4 sources - I'm getting:

1>LIBCMTD.lib(dosmap.obj) : error LNK2005: __dosmaperr already defined in libpqd.lib(win32error.obj)

This is the only error, and my searching so far has been fruitless. Note that I'm using the Multi-threaded Debug runtime library /MTd in all the libraries, which postgresql doesn't have by default; I've manually patched the win32.mak to use /MTd and /MT in place of the previously unconfigurable /MDd and /MD. This resolved some previous linker errors, but don't think it's related to this final one, as it was present prior.

I compile libpq via:

nmake /f win32.mak DEBUG=1

and link to it by:

#pragma comment ( lib, "libpqd.lib" )

The library directory is configured within the project, and the library is copied into this folder, so I know it's the correct one being used.

This is usually an error easily resolved, but I'm not sure where to look anymore!

A thread does exist about this on the postgresql site, but doesn't appear to have been resolved: http://www.postgresql.org/message-id/39E6FC4547C24F9884435E23698B11DC@HIRO57887DE653

Was it helpful?

Solution

After having issues with it even with converting the project to /MDd, I decided to drop into the source.

<your_path>\postgresql-9.2.4\src\port\win32error.c -> comment out, or #if 0 the function _dosmaperr.

The libraries are generated and the application runs fine.

Doing a grep -R _dosmaperr ./ only revealed this one method; but include/port/win32.h and include/pg_config_os.h both had it as an extern.

Is a bit late for my mind to make proper head/tail of it, so good enough for now!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top