How to use decimal floating point in Gnu C ++ (g ++)?

GCC 4.5 added decimal floating point support to the runtime library (http://gcc.gnu.org/gcc-4.5/changes.html). I can compile the code, including using the namespace std :: decimal, then using decimal64, etc. In the code.

Unfortunately, I am missing a library for linking code. I could not find out which libraries should be needed. DFP support is included in gcc (--enable-decimal-float = dpd)

Also, should there be some quick way to provide decimal literals in code? Quickly, I mean user literals that are processed by templates and translated at compile time. I do not want to provide duplicates that are converted at runtime (despite the performance and the fact that I really can not transfer estimates from compile time to runtime, there are still rounding problems ...). I already found the suffix "df", but this does not seem to be recognized by the compiler.

I am using gcc version 4.7.1 for the target powerpc-ibm-aix7.1.0.0.

Linker Error Messages:

ld: 0711-317 ERROR: Undefined symbol: .__dpd_floatsisd ld: 0711-317 ERROR: Undefined symbol: .__dpd_floatsidd ld: 0711-317 ERROR: Undefined symbol: .__dpd_floatsitd ld: 0711-317 ERROR: Undefined symbol: .__dpd_mulsd3 ld: 0711-317 ERROR: Undefined symbol: .__dpd_muldd3 ld: 0711-317 ERROR: Undefined symbol: .__dpd_multd3 ld: 0711-317 ERROR: Undefined symbol: .__dpd_floatdisd ld: 0711-317 ERROR: Undefined symbol: .__dpd_floatunsdisd ld: 0711-317 ERROR: Undefined symbol: .__dpd_floatdidd ld: 0711-317 ERROR: Undefined symbol: .__dpd_floatunsdidd ld: 0711-317 ERROR: Undefined symbol: .__dpd_floatditd ld: 0711-317 ERROR: Undefined symbol: .__dpd_floatunsditd 

TIA.

+7
source share
1 answer

I recently compiled gcc4.7.1 from the source and had problems with the missing __floatunsidf character. This turned out to be the symbol required by libstdc ++, so it is defined in libgcc_s.so. Given that both libraries are provided by gcc, they must be compatible. In my case, I still had the linker included in the old version of libgcc_s, which I removed from my target platform. Probably worth doing

 # to find out where libstdc++.so is: gcc -print-file-name=libstdc++.so # see if it references the symbol you're missing readelf -a "path to libstdc++.so" | grep "symbol name" 

and then do the same for libgcc_s to determine if they both define the character you are missing. Nb will mark the symbol as undefined - this is how the linker knows what is required.

+1
source

All Articles