[vtkusers] 'register' storage class specifier is deprecated

David Gobbi david.gobbi at gmail.com
Fri Sep 1 18:16:13 EDT 2017


Hi Matheus,

These are just warnings, not errors, so you can ignore them.  You are
seeing them because your code uses C++ features that are deprecated in
C++11, and VTK now requires C++11.

Fixing the "register" problem is easy.  Just remove it from your code.

As for the -Wc++11-narrowing warnings, you can fix them as the compiler
suggests: add a static_cast.

    attribute newAtt_1 = {"#End points", static_cast<double>(ne)};

There is already lots of info about these C++11 deprecations on
stackoverflow and similar places.

 - David


On Fri, Sep 1, 2017 at 3:52 PM, Matheus Viana <vianamp at gmail.com> wrote:

> Hi guys. I compiled VTK8 with no problem on Mac OS 10.12. However, when I
> try to compile one of my codes that was working on VTK7, I got the
> following error.
>
> Any advice?
>
> [ 25%] Building CXX object CMakeFiles/MitoGraph.dir/MitoGraph.cxx.o
> /Users/mviana/Desktop/MitoGraph/MitoGraph.cxx:576:19: warning: 'register'
> storage class specifier is deprecated and
>       incompatible with C++1z [-Wdeprecated-register]
>         vtkIdType register id;
>                   ^~~~~~~~~
> /Users/mviana/Desktop/MitoGraph/MitoGraph.cxx:1129:9: warning: 'register'
> storage class specifier is deprecated and
>       incompatible with C++1z [-Wdeprecated-register]
>     int register j, i;
>         ^~~~~~~~~
> /Users/mviana/Desktop/MitoGraph/MitoGraph.cxx:1129:9: warning: 'register'
> storage class specifier is deprecated and
>       incompatible with C++1z [-Wdeprecated-register]
>     int register j, i;
>         ^~~~~~~~~
> /Users/mviana/Desktop/MitoGraph/MitoGraph.cxx:1339:41: error:
> non-constant-expression cannot be narrowed from type
>       'long' to 'double' in initializer list [-Wc++11-narrowing]
>     attribute newAtt_1 = {"#End points",ne};
>                                         ^~
> /Users/mviana/Desktop/MitoGraph/MitoGraph.cxx:1339:41: note: insert an
> explicit cast to silence this issue
>     attribute newAtt_1 = {"#End points",ne};
>                                         ^~
>                                         static_cast<double>( )
> /Users/mviana/Desktop/MitoGraph/MitoGraph.cxx:1341:43: error:
> non-constant-expression cannot be narrowed from type
>       'long' to 'double' in initializer list [-Wc++11-narrowing]
>     attribute newAtt_2 = {"#Bifurcations",nb};
>                                           ^~
> /Users/mviana/Desktop/MitoGraph/MitoGraph.cxx:1341:43: note: insert an
> explicit cast to silence this issue
>     attribute newAtt_2 = {"#Bifurcations",nb};
>                                           ^~
>                                           static_cast<double>( )
>
>
>
> Matheus Viana
> IBM Research | Brazil
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170901/a080bbcd/attachment.html>


More information about the vtkusers mailing list