decNumber and Visual Studio think 10

Sviatoslav Feshchenko has reported that Visual Studio 2010 (32 bit) A decNumber user has reported that Visual Studio 2010 (32 bit) has difficulty with compiling the decNumber source files.

Here are his two work-arounds – many thanks for these.


 
Method 1:

The design of the library is such that decBasic.c and decCommon.c are shared source files that are included in other source files. Therefore these 2 files should not be compiled into object code files. To disable compilation of individual source files in Visual Studio 2010, right click on the file you want to exclude from compilation in the "Solution Explorer", and select "Properties". Under "Configuration Properties", select "General" and set "Exclude from build" property to "Yes".


 
Method 2:

In file: "decBasic.c"
1. Change extension from .c to .h

2. Add the following at the beginning of the code:
#if !defined(DECBASIC)
#define DECBASIC

3. Add the following at the end of the code:
#endif

4. Replace the following line 2 lines
#error decBasic.c must be included after decCommon.c
#error Routines in decBasic.c are for decDouble and decQuad only
with
#error decBasic.h must be included after decCommon.h
#error Routines in decBasic.h are for decDouble and decQuad only
respectively.

In file "decCommon.c"
1. Change extension from .c to .h

2. Add the following at the beginning of the code:
#if !defined(DECCOMMON)
#define DECCOMMON
3. Add the following at the end of the code:
#endif

In the following files:
decQuad.c
decDouble.c
decSingle.c

replace lines:
#include "decCommon.c"
#include "decBasic.c"

with
#include "decCommon.h"
#include "decBasic.h"

as applicable.

References to decCommon.c and decBasic.c in commentary should also be modified to refer to the corresponding .h.