generic-msvc.h(91): error C2664

Started by Vicky Vergaraabout 8 years ago2 messages
#1Vicky Vergara
vicky_vergara@hotmail.com

Hello all

I am trying to compile pgRouting on appveyor CI when compiling with pg >= 9.5

I am getting the following error:

C:\Program Files\PostgreSQL\9.5\include\server\port/atomics/generic-msvc.h(91): error C2664: '__int64 _InterlockedCompareExchange64(volatile __int64 *,__int64,__int64)' : cannot convert argument 1 from 'volatile uint64 *' to 'volatile __int64 *' [C:\build\pgrouting\build\pg95\x64\src\tsp\tsp.vcxproj]

This error happens when C++ code that needs palloc is being compiled.

There is no problem when compiling C code.

On the documentation of the _InterlockedExchangeAdd64 [1]https://docs.microsoft.com/en-us/cpp/intrinsics/interlockedexchangeadd-intrinsic-functions there is no uint64 * type

This code [2]https://github.com/postgres/postgres/blob/REL9_5_STABLE/src/include/port/atomics/generic-msvc.h#L101 use [3]https://github.com/postgres/postgres/blob/REL9_5_STABLE/src/include/port/atomics/generic-msvc.h#L43 where uint64 is used

Maybe I am doing something wrong including some postgres files on these [4]https://github.com/cvvergara/pgrouting/blob/appveyor-pg95/include/cpp_common/pgr_alloc.hpp & [5]https://github.com/cvvergara/pgrouting/blob/appveyor-pg95/include/c_common/postgres_connection.h.

A sample compilation with this error is in [6]https://ci.appveyor.com/project/cvvergara/pgrouting/build/2.6.1936#L415 and there is no problem at all with pg 9.4 [7]https://ci.appveyor.com/project/cvvergara/pgrouting/build/2.6.1934 <https://github.com/postgres/postgres/blob/master/src/include/port/atomics/generic-msvc.h#L41&gt;

Any feedback would be greatly appreciated

Vicky

[1]: https://docs.microsoft.com/en-us/cpp/intrinsics/interlockedexchangeadd-intrinsic-functions

[2]: https://github.com/postgres/postgres/blob/REL9_5_STABLE/src/include/port/atomics/generic-msvc.h#L101

[3]: https://github.com/postgres/postgres/blob/REL9_5_STABLE/src/include/port/atomics/generic-msvc.h#L43

[4]: https://github.com/cvvergara/pgrouting/blob/appveyor-pg95/include/cpp_common/pgr_alloc.hpp

[5]: https://github.com/cvvergara/pgrouting/blob/appveyor-pg95/include/c_common/postgres_connection.h

[6]: https://ci.appveyor.com/project/cvvergara/pgrouting/build/2.6.1936#L415

[7]: https://ci.appveyor.com/project/cvvergara/pgrouting/build/2.6.1934 <https://github.com/postgres/postgres/blob/master/src/include/port/atomics/generic-msvc.h#L41&gt;
<https://github.com/postgres/postgres/blob/master/src/include/port/atomics/generic-msvc.h#L41&gt;

#2Vicky Vergara
vicky_vergara@hotmail.com
In reply to: Vicky Vergara (#1)
Re: generic-msvc.h(91): error C2664

Hello all

FYI: I think I solved it by not including the files and only using

extern "C" {

extern
void* SPI_palloc(size_t size);

extern void *
SPI_repalloc(void *pointer, size_t size);

extern void
SPI_pfree(void *pointer);

}

Thanks

Vicky

________________________________
De: Vicky Vergara <vicky_vergara@hotmail.com>
Enviado: martes, 21 de noviembre de 2017 09:01 p. m.
Para: pgsql-hackers@postgresql.org
Asunto: generic-msvc.h(91): error C2664

Hello all

I am trying to compile pgRouting on appveyor CI when compiling with pg >= 9.5

I am getting the following error:

C:\Program Files\PostgreSQL\9.5\include\server\port/atomics/generic-msvc.h(91): error C2664: '__int64 _InterlockedCompareExchange64(volatile __int64 *,__int64,__int64)' : cannot convert argument 1 from 'volatile uint64 *' to 'volatile __int64 *' [C:\build\pgrouting\build\pg95\x64\src\tsp\tsp.vcxproj]

This error happens when C++ code that needs palloc is being compiled.

There is no problem when compiling C code.

On the documentation of the _InterlockedExchangeAdd64 [1]https://docs.microsoft.com/en-us/cpp/intrinsics/interlockedexchangeadd-intrinsic-functions there is no uint64 * type

This code [2]https://github.com/postgres/postgres/blob/REL9_5_STABLE/src/include/port/atomics/generic-msvc.h#L101 use [3]https://github.com/postgres/postgres/blob/REL9_5_STABLE/src/include/port/atomics/generic-msvc.h#L43 where uint64 is used

Maybe I am doing something wrong including some postgres files on these [4]https://github.com/cvvergara/pgrouting/blob/appveyor-pg95/include/cpp_common/pgr_alloc.hpp & [5]https://github.com/cvvergara/pgrouting/blob/appveyor-pg95/include/c_common/postgres_connection.h.

A sample compilation with this error is in [6]https://ci.appveyor.com/project/cvvergara/pgrouting/build/2.6.1936#L415 and there is no problem at all with pg 9.4 [7]https://ci.appveyor.com/project/cvvergara/pgrouting/build/2.6.1934 <https://github.com/postgres/postgres/blob/master/src/include/port/atomics/generic-msvc.h#L41&gt;

Any feedback would be greatly appreciated

Vicky

[1]: https://docs.microsoft.com/en-us/cpp/intrinsics/interlockedexchangeadd-intrinsic-functions

[2]: https://github.com/postgres/postgres/blob/REL9_5_STABLE/src/include/port/atomics/generic-msvc.h#L101

[3]: https://github.com/postgres/postgres/blob/REL9_5_STABLE/src/include/port/atomics/generic-msvc.h#L43

[4]: https://github.com/cvvergara/pgrouting/blob/appveyor-pg95/include/cpp_common/pgr_alloc.hpp

[5]: https://github.com/cvvergara/pgrouting/blob/appveyor-pg95/include/c_common/postgres_connection.h

[6]: https://ci.appveyor.com/project/cvvergara/pgrouting/build/2.6.1936#L415

[7]: https://ci.appveyor.com/project/cvvergara/pgrouting/build/2.6.1934 <https://github.com/postgres/postgres/blob/master/src/include/port/atomics/generic-msvc.h#L41&gt;
<https://github.com/postgres/postgres/blob/master/src/include/port/atomics/generic-msvc.h#L41&gt;