[GRASS-dev] Compiling r.viewshed and r.terraflow with C++11

Vaclav Petras wenzeslaus at gmail.com
Mon Dec 9 20:21:11 PST 2013


the r.viewshed and r.terraflow modules needs fix to compile with C++11. The
errors are:

 error: reference to 'is_empty' is ambiguous
 error: reference to 'is_void' is ambiguous

The cause are the functions in modules which are named in the same way as
functions newly added in C++11. The problem is actually caused by the fact
that modules are using

 using namespace std;

As explained by Glynn in [1] rewriting modules in the way that they don't
use `std` namespace in this way could be difficult.

So my question is, was this fixed in the time of [1]? It is not clear from
the discussion. If not, what is the right fix?

I suggest to put these functions into some namespace (I was not thinking
about name yet) and using these functions with a namespace. There is only
limited number of calls of these functions. Do you think it is a good idea?

Apparently, this issue needs to be fixed because on Mac OS X Mavericks it
is already an issue (C++11 is the default as predicted by Glynn in [1]).
Compile error should be reproducible with older GCC/clang by adding
`-std=c++11` option.


[1] Grass SVN in Android, display issue,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20131209/e9b44a30/attachment.html>

More information about the grass-dev mailing list