decNumber library - compile issues

China☆狼群 提交于 2019-12-11 04:43:12

问题


I am having issues compiling the decNumber http://speleotrove.com/decimal/, source is here http://download.icu-project.org/files/decNumber/decNumber-icu-368.zip (includes examples etc. that need to be deleted)

Has anyone compiled this successfully? Your comments will be much appreciated!!

The compiler issues an error as a result of the following directives:

#if !defined(QUAD)
#error decBasic.c must be included after decCommon.c
#endif

(This is a small section of code from decCommon.c and decBasic.c is another source file)

The author of the code states in comments that these 2 source files are shared. There are no corresponding .h files.

I am on Windows 7 64 bit, compiling with Visual Studio 2010 32 bit.

Thank you in advance for your help.


回答1:


decBasic.c and decCommon.c are #included at the BOTTOM of the specific implementation files (such as decDouble.c). So - you shouldn't compile decBasic.c or decCommon.c, but treat them like header files.

If you look at the MAKE file included, you can see what the compilation targets are: decBasic and decCommon are missing.

If you are using Visual Studio, you can add decBasic.c and decCommon.c as headers, so they appear in the project but will not be compiled.




回答2:


decNumber is not in a compilable state in its original form as it requires some source code modifications to include standard integer types. QDecimal library handles this issue by using slightly modified version of decNumber. Please see QDecimal project for details:

http://code.google.com/p/qdecimal/

http://code.google.com/p/qdecimal/source/browse/doc/INSTALL.txt




回答3:


When compiling with Visual Studio 2010 do not include decBasic.c and decCommmon.c to the project. These files are include-only and should not be compiled separately. In my case I am using decDouble module only and my project is setup as follows:

  • Header Files
    • decContext.h
    • decDouble.h
    • decDPD.h
    • decnumberlocal.h
    • decQuad.h
  • Source Files
    • decContext.c
    • decDouble.c
    • decQuad.c

Additionally files decBasic.c and decCommon.c are in the same directory where decQuad.c is located.



来源:https://stackoverflow.com/questions/9337351/decnumber-library-compile-issues

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!