Problem linking to libpq.lib on Windows

Поиск
Список
Период
Сортировка
Искать

Problem linking to libpq.lib on Windows

От:
Roberto de Figueiredo Ribeiro <roberto.f.ribeiro@dnit.gov.br>
Дата:

Hi list,

 

I’m building a platform on C++ that uses parts of the libpq-fe.h in it. I had been previously compiling it in linux, and all was fine. Switched to windows, now during linking it accuses an error, unable to find an object file.

 

This is the line I’m compiling with:

 

>: cl /I path\to\include main.cpp /link /libpath path\to\lib –opt:ref libpq.lib

 

And the error I get is:

 

>: LINK: fatal error LNK1181: cannot open input file ‘path\to\postgres\lib.obj’

 

Is this “lib.obj” file actually required by the linker? Or is this something that should be created on-the-fly, and perhaps the compiler is pointing somewhere else?

Re: Problem linking to libpq.lib on Windows

От:
Dmitry Igrishin <dmitigr@gmail.com>
Дата:
чт, 14 февр. 2019 г. в 12:54, Roberto de Figueiredo Ribeiro
:
>
> Hi list,
>
>
>
> I’m building a platform on C++ that uses parts of the libpq-fe.h in it. I had been previously compiling it in linux, and all was fine. Switched to windows, now during linking it accuses an error, unable to find an object file.
>
>
>
> This is the line I’m compiling with:
>
>
>
> >: cl /I path\to\include main.cpp /link /libpath path\to\lib –opt:ref libpq.lib
Try this (not the colons):
cl /I "path\to\include" main.cpp /link /libpath:"path\to\lib" /opt:ref libpq.lib

RES: Problem linking to libpq.lib on Windows

От:
Roberto de Figueiredo Ribeiro <roberto.f.ribeiro@dnit.gov.br>
Дата:
Oof! Works now, thanks for the help!

-----Mensagem original-----
De: Dmitry Igrishin [mailto:dmitigr@gmail.com] 
Enviada em: quinta-feira, 14 de fevereiro de 2019 08:59
Para: Roberto de Figueiredo Ribeiro 
Cc: pgsql-general@postgresql.org
Assunto: Re: Problem linking to libpq.lib on Windows

чт, 14 февр. 2019 г. в 12:54, Roberto de Figueiredo Ribeiro
:
>
> Hi list,
>
>
>
> I’m building a platform on C++ that uses parts of the libpq-fe.h in it. I had been previously compiling it in linux, and all was fine. Switched to windows, now during linking it accuses an error, unable to find an object file.
>
>
>
> This is the line I’m compiling with:
>
>
>
> >: cl /I path\to\include main.cpp /link /libpath path\to\lib –opt:ref libpq.lib
Try this (not the colons):
cl /I "path\to\include" main.cpp /link /libpath:"path\to\lib" /opt:ref libpq.lib
FAQ