# Mac build error in superclass array initializer in mrml volume rendering properties

**URL:** https://discourse.slicer.org/t/mac-build-error-in-superclass-array-initializer-in-mrml-volume-rendering-properties/2270
**Category:** Development
**Created:** [March 8, 2018, 5:29pm UTC](https://discourse.slicer.org/t/mac-build-error-in-superclass-array-initializer-in-mrml-volume-rendering-properties/2270 "2018-03-08T17:29:38Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [March 8, 2018, 5:29pm UTC](https://discourse.slicer.org/t/mac-build-error-in-superclass-array-initializer-in-mrml-volume-rendering-properties/2270/1 "2018-03-08T17:29:38Z")

</div>

When I build now on mac I get the error below (related to [this recent commit about volume rendering presets](https://github.com/Slicer/Slicer/commit/f4b50114908e98b1b6226f4b2e75bd95eb01e75b0)).

```auto
/Users/pieper/slicer4/latest/Slicer/Modules/Loadable/VolumeRendering/MRML/vtkMRMLVolumePropertyNode.cxx:27:19: error: expected '('
  , EffectiveRange{0.0, -1.0}
                  ^

```

> **more of the build errors**
>
> ```auto
> /Users/pieper/slicer4/latest/Slicer/Modules/Loadable/VolumeRendering/MRML/vtkMRMLVolumePropertyNode.cxx:27:20: warning: expression result unused [-Wunused-value]
> , EffectiveRange{0.0, -1.0}
> ^~~
> /Users/pieper/slicer4/latest/Slicer/Modules/Loadable/VolumeRendering/MRML/vtkMRMLVolumePropertyNode.cxx:27:29: error: expected ';' after expression
> , EffectiveRange{0.0, -1.0}
> ^
> ;
> /Users/pieper/slicer4/latest/Slicer/Modules/Loadable/VolumeRendering/MRML/vtkMRMLVolumePropertyNode.cxx:27:25: warning: expression result unused [-Wunused-value]
> , EffectiveRange{0.0, -1.0}
> ^~~~
> /Users/pieper/slicer4/latest/Slicer/Modules/Loadable/VolumeRendering/MRML/vtkMRMLVolumePropertyNode.cxx:28:3: error: expected unqualified-id
> , DisabledModify(0)
> ^
> 2 warnings and 3 errors generated.
> 
> ```

I can work around it with this patch but I wonder if there’s a better solution:

```auto
 vtkMRMLVolumePropertyNode::vtkMRMLVolumePropertyNode()
   : VolumeProperty(NULL)
- , EffectiveRange{0.0, -1.0}
   , DisabledModify(0)
 {
+ this->EffectiveRange[0] = 0.0;
+ this->EffectiveRange[1] = -1.0;

```

This error doesn’t happen on the dashboard machine, maybe because it [uses a custom compiler](http://slicer-devel-archive.65872.n3.nabble.com/MacOSX-factory-build-Transitioning-from-hybrid-quot-llvm-g-quot-to-quot-clang-quot-Update-to-Qt-4-8-6-tt4032198.html#a4032199). I do not get the build error on linux.

I’m using the standard Xcode clang on mac. Does anyone else have the same problem?

```auto
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin17.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

```

---

<div class="post-metadata">

### Author: ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)
#### Post date: [March 8, 2018, 7:19pm UTC](https://discourse.slicer.org/t/mac-build-error-in-superclass-array-initializer-in-mrml-volume-rendering-properties/2270/2 "2018-03-08T19:19:25Z")

</div>

I can build on my Mac - 10.12.6, my compiler:

```
~/Development/slicer/Slicer:7> llvm-gcc --version
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
```

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [March 8, 2018, 7:28pm UTC](https://discourse.slicer.org/t/mac-build-error-in-superclass-array-initializer-in-mrml-volume-rendering-properties/2270/3 "2018-03-08T19:28:38Z")

</div>

Update: This error only occurs on a Qt4 build (Qt5 build on same machine works) so this is a C++ 11 issue.

---

<div class="post-metadata">

### Author: ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)
#### Post date: [March 8, 2018, 7:29pm UTC](https://discourse.slicer.org/t/mac-build-error-in-superclass-array-initializer-in-mrml-volume-rendering-properties/2270/4 "2018-03-08T19:29:14Z")

</div>

After talking with @pieper, his build was done against Qt4. This explains the error because in that case, `C++98` was used.

Until Slicer 5 is out, I suggest we keep the code base compatible with both.

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [March 8, 2018, 7:29pm UTC](https://discourse.slicer.org/t/mac-build-error-in-superclass-array-initializer-in-mrml-volume-rendering-properties/2270/5 "2018-03-08T19:29:50Z")

</div>

I’m planning to fix it like this, so we’ll remember to fix it when we switch to C++11 only.

```auto
//----------------------------------------------------------------------------
vtkMRMLVolumePropertyNode::vtkMRMLVolumePropertyNode()
  : VolumeProperty(NULL)
#if __cplusplus >= 201103L
  , EffectiveRange{0.0,-1.0}
#endif
  , DisabledModify(0)
{
#if __cplusplus < 201103L
  this->EffectiveRange[0] = 0.0;
  this->EffectiveRange[1] = -1.0;
#endif

```

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [March 8, 2018, 7:38pm UTC](https://discourse.slicer.org/t/mac-build-error-in-superclass-array-initializer-in-mrml-volume-rendering-properties/2270/6 "2018-03-08T19:38:47Z")

</div>

Confirmed it builds in both modes and [committed as r27027](http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=27027).
