# Msvc 2010 build problems

**URL:** <https://www.ruby-forum.com/t/msvc-2010-build-problems/233338>\
**Category:** GNU Radio\
**Created:** [December 5, 2014, 11:03am UTC](https://www.ruby-forum.com/t/msvc-2010-build-problems/233338 "2014-12-05T11:03:23Z")\
**Posts on this page:** 1\
**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:** [December 5, 2014, 11:03am UTC](https://www.ruby-forum.com/t/msvc-2010-build-problems/233338/1 "2014-12-05T11:03:23Z")

</div>

Hello,  
I made an attempt to compile the actual git master branch with MSVC2010  
under win 7.  
There some issues which I want list as follows. (Sorry for some german  
compiler  
messages, but I think there are self explanatory.)

It would be fine if gnuradio can also be builded by MSVC compiler in the  
future as we had in the past.

Thanks,  
Dietmar

## prob 1

This is a known issue with log2() and ‘not’, ‘and’, ‘or’ macros - see

[http://lists.gnu.org/archive/html/discuss-gnuradio/2014-10/msg00413.html](http://lists.gnu.org/archive/html/discuss-gnuradio/2014-10/msg00413.html)

diff --git a/cmake/msvc/config.h b/cmake/msvc/config.h  
index 43792c7…4a56713 100644  
— a/cmake/msvc/config.h  
+++ b/cmake/msvc/config.h  
@@ -29,6 +29,18 @@ static inline long long llrintf(float x){return (long  
long)(x \> 0.0f ? x + 0.5f  
static inline double rint(double x){return (x \> 0.0)? floor(x + 0.5) :  
ceil(x - 0.5);}  
static inline float rintf(float x){return (x \> 0.0f)? floorf(x + 0.5f)  
: ceilf(x - 0.5f);}

+#if (\_MSC\_VER \<= 1600)  
+static inline double log2 (double x)  
+{

- return log ((double)x) / log (2.0F);  
+}  
+#endif
- 

+// Use of ISO-646 keyword (‘not’, ‘and’ etc. needs this header.  
+#ifdef \_\_cplusplus  
+#include   
+#endif  
+  
////////////////////////////////////////////////////////////////////////  
// math constants  
////////////////////////////////////////////////////////////////////////

## prob 2

Also known problem, msvc can only make init in cc file, not in header  
file. - see:

[https://gnuradio.org/redmine/issues/742](https://gnuradio.org/redmine/issues/742)

diff --git a/gr-dtv/lib/atsc/atsc\_sync\_impl.cc  
b/gr-dtv/lib/atsc/atsc\_sync\_impl.cc  
index ec46d6b…38f2174 100644  
— a/gr-dtv/lib/atsc/atsc\_sync\_impl.cc  
+++ b/gr-dtv/lib/atsc/atsc\_sync\_impl.cc  
@@ -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)
{

```

diff --git a/gr-dtv/lib/atsc/atsc\_sync\_impl.h  
b/gr-dtv/lib/atsc/atsc\_sync\_impl.h  
index eb0ad17…c3e2d61 100644  
— a/gr-dtv/lib/atsc/atsc\_sync\_impl.h  
+++ b/gr-dtv/lib/atsc/atsc\_sync\_impl.h  
@@ -34,8 +34,8 @@ namespace gr {  
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; // 0.0005 

```

works

- 

```
 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;

## prob 3

Seems volk\_malloc doesn’t need pthreads because msvc using windows  
threads. The include is new compared to version 3.6.5.1.  
#ifdef would be sufficient.

diff --git a/volk/lib/volk\_malloc.c b/volk/lib/volk\_malloc.c  
index d5e1709…235793d 100644  
— a/volk/lib/volk\_malloc.c  
+++ b/volk/lib/volk\_malloc.c  
@@ -20,7 +20,6 @@

- Boston, MA 02110-1301, USA.  
\*/

-#include \<pthread.h\>  
#include \<volk/volk\_malloc.h\>  
#include \<stdio.h\>  
#include \<stdlib.h\>

## prob 4

new compiler error, has worked under 3.6.5.1

…....\gr-audio\lib\portaudio\portaudio\_source.cc(124): error C2039:  
‘write’: Ist kein Element von ‘`global namespace’’  
…....\gr-audio\lib\portaudio\portaudio\_source.cc(124): error C3861:  
“write”: Bezeichner wurde nicht gefunden.

…....\gr-audio\lib\portaudio\portaudio\_sink.cc(121): error C2039:  
‘write’: Ist kein Element von ‘`global namespace’’  
…....\gr-audio\lib\portaudio\portaudio\_sink.cc(121): error C3861:  
“write”: Bezeichner wurde nicht gefunden.

## prob 5

As follows is a link problem. qwt.lib version (using qwt 6.1.1) is in  
the link list and was formerly used to build version 3.6.5.1 successful.  
It seems that the decoration of the imported functions has changed.

------ Erstellen gestartet: Projekt: pygen\_gnuradio\_runtime\_swig\_42898,  
Konfiguration: Release Win32 ------  
TimeRasterDisplayPlot.obj : error LNK2019: Verweis auf nicht aufgelöstes  
externes Symbol “”\_\_declspec(dllimport) public: \_\_thiscall  
QwtInterval::QwtInterval(class QwtInterval const &)"  
(\__imp_??0QwtInterval@@QAE@ABV0@@Z)" in Funktion ““public: double  
\_\_thiscall TimeRasterDisplayPlot::getMinIntensity(int)const "  
(?getMinIntensity@TimeRasterDisplayPlot@@QBENH@Z)”.  
WaterfallDisplayPlot.obj : error LNK2001: Nicht aufgelöstes externes  
Symbol “”\_\_declspec(dllimport) public: \_\_thiscall  
QwtInterval::QwtInterval(class QwtInterval const &)”  
(\__imp_??0QwtInterval@@QAE@ABV0@@Z)“.  
plot\_waterfall.obj : error LNK2001: Nicht aufgelöstes externes Symbol  
“”\_\_declspec(dllimport) public: \_\_thiscall  
QwtInterval::QwtInterval(class QwtInterval const &)”  
(\__imp_??0QwtInterval@@QAE@ABV0@@Z)“.  
plot\_raster.obj : error LNK2001: Nicht aufgelöstes externes Symbol  
“”\_\_declspec(dllimport) public: \_\_thiscall  
QwtInterval::QwtInterval(class QwtInterval const &)”  
(\__imp_??0QwtInterval@@QAE@ABV0@@Z)".
