Skip to Content
0

Error LNK2019 when using DecFloat library

Jan 09, 2017 at 03:05 PM

51

avatar image

Hello,

I was trying to compile a simple 32 Bit program, that uses the SAP DecFloat library (sapdecfICUlib) on windows 10 x64 using the Visual Studio 2008 compiler.

I was using the compiler and linker flags as defined in https://launchpad.support.sap.com/#/notes/1056696. But when I try to link the program I get the following errors (translated from german):

test.obj : error LNK2019: Reference to unresolved external Symbol "_decf_mutex_unlock" in Function "_main".
test.obj : error LNK2019: Reference to unresolved external Symbol "_decf_mutex_lock" in Function "_main".
sapdecfICUlib.lib(sapdecfICU.obj) : error LNK2019: Reference to unresolved external Symbol "_DlLoadFunc" in Function "_InitDecFloatLib".
sapdecfICUlib.lib(sapdecfICU.obj) : error LNK2019: Reference to unresolved external Symbol "_DpTrc" in Function "_InitDecFloatLib".
sapdecfICUlib.lib(sapdecfICU.obj) : error LNK2019: Reference to unresolved external Symbol "_DpUnlock" in Function "_InitDecFloatLib".
sapdecfICUlib.lib(sapdecfICU.obj) : error LNK2019: Reference to unresolved external Symbol "_DpTrcErr" in Function "_InitDecFloatLib".
sapdecfICUlib.lib(sapdecfICU.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "_ab_tf".
sapdecfICUlib.lib(sapdecfICU.obj) : error LNK2019: Reference to unresolved external Symbol "_CTrcSaveLocation" in Function "_InitDecFloatLib".
sapdecfICUlib.lib(sapdecfICU.obj) : error LNK2019: Reference to unresolved external Symbol "_DpLock" in Function "_InitDecFloatLib".
sapdecfICUlib.lib(sapdecfICU.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "_ct_level".
sapdecfICUlib.lib(sapdecfICU.obj) : error LNK2019: Reference to unresolved external Symbol "_DlLoadLib" in Function "_InitDecFloatLib".
sapdecfICUlib.lib(sapdecfICU.obj) : error LNK2019: Reference to unresolved external Symbol "_B7sToUcs" in Function "_InitDecFloatLib".
sapdecfICUlib.lib(sapdecfICU.obj) : error LNK2019: Reference to unresolved external Symbol "_B7nToUcn" in Function "_DecFloat16ToString".
sapdecfICUlib.lib(sapdecfICU.obj) : error LNK2019: Reference to unresolved external Symbol "_UcnToB7n" in Function "_StringToDecFloat16".
sapdecfICUlib.lib(sapdecfICU.obj) : error LNK2019: Reference to unresolved external Symbol "_snprintf_sRFB" in Function "_SAP_DOUBLEToDecFloat16".
test.exe : fatal error LNK1120: 15 unresolved external symbols

My test.cpp looks like this:

#include <stdio.h>
#include "sapnwrfc.h"
#include "sapdecf.h"


int main(void) {
    RFC_DECF16 decf;
    SAP_DOUBLE d = 13.37;
    SAP_DOUBLE test = 0.0;
    // Initialize the DecFloatLib
    if(InitDecFloatLib() != DECF_OK) {
        printf("Initialization of DecFloat Lib not successfull");
        return -1;
    }
    // Now try to convert the SAP_DOUBLE to DecFloat16 and back
    decf_mutex_lock();
    if(SAP_DOUBLEToDecFloat16(&decf, d) != DECF_OK) {
        printf("Conversion from SAP_DOUBLE to DecFloat16 not successfull");
        return -1;
    }
    if(DecFloat16ToSAP_DOUBLE(&test, decf) != DECF_OK) {
        printf("Conversion from DecFloat16 to SAP_DOUBLE not successfull");
        return -1;
    }
    decf_mutex_unlock();
    // Now check if the values match
    if(d != test) {
        printf("Values do not match: %f != %f", d, test);
        return -1;
    }
    // Everyting ok
    return 0;
}

And is compiled using the following command lines:

cl -DBCDASM -nologo -Od -Ob1 -fp:strict -Gy -GF -EHs -Z7 -W3 -Wp64 -D_X86_ -DWIN32 -DSAPwithUNICODE -DUNICODE -D_UNICODE -MD -D_AFXDLL -FR -J -RTC1 -D_CRT_NON_CONFORMING_SWPRINTFS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DSAPonNT -c /EHc- /TP test.cpp


link -nologo /NXCOMPAT -STACK:0x800000 ole32.lib rpcrt4.lib oleaut32.lib oledb.lib uuid.lib kernel32.lib advapi32.lib user32.lib gdi32.lib winspool.lib ws2_32.lib Iphlpapi.lib netapi32.lib comdlg32.lib shell32.lib dbghelp.lib version.lib mpr.lib secur32.lib -OPT:REF -LARGEADDRESSAWARE -subsystem:console -out:test.exe test.obj sapnwrfc.lib libsapucum.lib sapdecfICUlib.lib

(The NWRFC SDK library and headers files are in the same directory as the test.cpp).

Any suggestions on how to use the SAP DecFloat library?

Best regards,

Torben

10 |10000 characters needed characters left characters exceeded

Is no one using the DecFloat Datatypes from the NW RFC SDK?

Please. Someone help!

0
* Please Login or Register to Answer, Follow or Comment.

0 Answers