# MSVC v16 'static const' error

**URL:** <https://www.ruby-forum.com/t/msvc-v16-static-const-error/232547>\
**Category:** GNU Radio\
**Created:** [October 15, 2014, 7:28pm UTC](https://www.ruby-forum.com/t/msvc-v16-static-const-error/232547 "2014-10-15T19:28:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [October 15, 2014, 7:28pm UTC](https://www.ruby-forum.com/t/msvc-v16-static-const-error/232547/1 "2014-10-15T19:28:50Z")

</div>

I just got this error from MSVC v16 while trying to compile  
atsc\_sync\_impl.cc:  
g:\gv\dx-radio\gnuradio-3.x\gr-dtv\lib\atsc\atsc\_sync\_impl.h(37) :  
error C2864: ‘gr::dtv::atsc\_sync\_impl::LOOP\_FILTER\_TAP’ : only static  
const  
integral data members can be initialized within a class

g:\gv\dx-radio\gnuradio-3.x\gr-dtv\lib\atsc\atsc\_sync\_impl.h(38) :  
error C2864: ‘gr::dtv::atsc\_sync\_impl::ADJUSTMENT\_GAIN’ : only static  
const  
integral data members can be initialized within a class

The code works fine with g++ 4.7.2. I figured these ‘private const data’  
had to be initialised in the .cc-file. Here is how I patched it:

— atsc\_sync\_impl.cc.orig 2014-08-18 22:46:57 +0000  
+++ atsc\_sync\_impl.cc 2014-10-15 19:14:01 +0000  
@@ -31,6 +31,9 @@  
namespace gr {  
namespace dtv {

- const double atsc\_sync\_impl::LOOP\_FILTER\_TAP = 0.0005; //  
0.0005 works
- const double atsc\_sync\_impl::ADJUSTMENT\_GAIN = 1.0e-5 / (10 \*  
ATSC\_DATA\_SEGMENT\_LENGTH);
- atsc\_sync::sptr  
atsc\_sync::make(float rate)  
{  
— atsc\_sync\_impl.h.orig 2014-08-18 22:46:57 +0000  
+++ ./atsc\_sync\_impl.h 2014-10-15 19:24:45 +0000  
@@ -34,8 +34,8 @@  
class atsc\_sync\_impl : public atsc\_sync  
{  
private:

- 

```
 static const double LOOP_FILTER_TAP = 0.0005; // 0.0005 works

```

- 

```
 static const double ADJUSTMENT_GAIN = 1.0e-5 / (10 * 

```

ATSC\_DATA\_SEGMENT\_LENGTH);

- 

```
 static const double LOOP_FILTER_TAP; // = 0.0005

```

- 

```
 static const double ADJUSTMENT_GAIN; // = 1.0e-5 / (10 * 

```

ATSC\_DATA\_SEGMENT\_LENGTH);  
static const int SYMBOL\_INDEX\_OFFSET = 3;  
static const int MIN\_SEG\_LOCK\_CORRELATION\_VALUE = 5;  
static const int SSI\_MIN = -16;

–gv

---

<div class="post-metadata">

**Author:** ![Gisle\_V](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b782af/32.png) [@Gisle\_V](https://www.ruby-forum.com/u/Gisle_V)\
**Post date:** [October 16, 2014, 4:01pm UTC](https://www.ruby-forum.com/t/msvc-v16-static-const-error/232547/2 "2014-10-16T16:01:00Z")

</div>

Gisle,

Please open this as a ticket in our Issue tracker so that it doesn’t get  
lost in the email archives.

Thanks,  
Tom
