bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

C++ and read redefinition


From: Daniel R. Hurtmans
Subject: C++ and read redefinition
Date: Thu, 3 Dec 2020 17:37:04 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.3

Hello,

I'm using gnulib for quite a long time now to supply missing functions (eg: get_opt) in some C++ projects. And suddenly everything breaks down.

Apparently read is redefined to _read when compiling for Windows since this September. I'm cross compiling with x86_64-w64-mingw32.

In some classes I'm defining read, write or open members.
After digging in the archive I found the solution of including
#include <unistd.h> before my class header. Fine.

Now I'm facing another problem... since read is now _read it breaks pragmas...

Eg using the excellent Armadillo headers library i got this:

...
/usr/x86_64-w64-mingw32/include/armadillo_bits/arma_forward.hpp: In member function ‘arma::state_type::operator int() const’:

/usr/x86_64-w64-mingw32/include/armadillo_bits/arma_forward.hpp:289:26: error: expected ‘read’, ‘write’, ‘update’, ‘capture’, ‘seq_cst’, ‘acq_rel’, ‘release’, ‘relaxed’ or ‘hint’ clause
     289 |       #pragma omp atomic read
...

I'm including <armadillo> after <unistd.h>.
I tried defining GNULIB_NAMESPACE without success.

Any solution would be appreciated? I don't want to be stuck to a "pre-September" version.

Thanks,
Daniel

--
/----------------------------------------------------------------------\
| Daniel R. Hurtmans            http://www.ulb.ac.be/cpm               |
| Daniel.Hurtmans@ulb.ac.be                                            |
|                                                                      |
| Université Libre de Bruxelles / SQUARES                              |
|   |\     ___,,--,        _                                           |
|   /,`--''        \-,,__,'/   50 Av F.D. Roosevelt CPi 160/09         |
| |,4   ) )_    ) /~-----'     B-1050 Bruxelles, BELGIUM               |
\-'---^~(_/-_)--(_/_)--------------------------------------------------/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]