developers

    Forum Stats

  • 3,873,656 Users
  • 2,266,622 Discussions
  • 7,911,597 Comments

Discussions

LNK2091 error for OCIObjectGetAttr and OCIObjectSetAttr

CBikram
CBikram Member Posts: 5
edited Jun 3, 2014 8:46AM in Oracle Call Interface (OCI)

Hello all,

I have a small Windows x64 Console program statically linked to oci.lib (12.1.0.1.0) which was working well so far until I tried to use the APIs OCIObjectGetAttr/OCIObjectSetAttr. Now my program gives the following Linker errors:

Error19error LNK2019: unresolved external symbol "int __cdecl OCIObjectSetAttr(struct OCIEnv *,struct OCIError *,void *,void *,struct OCIType *,unsigned char const * *,unsigned int const *,unsigned int,unsigned int const *,unsigned int,short,void const *,void const *)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected]) referenced in function "bool __cdecl dump_object(struct OCIEnv *,struct OCIError *,struct OCISvcCtx *,void *,void *,void *)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected])
Error20error LNK2019: unresolved external symbol "int __cdecl OCIObjectGetAttr(struct OCIEnv *,struct OCIError *,void *,void *,struct OCIType *,unsigned char const * *,unsigned int const *,unsigned int,unsigned int const *,unsigned int,short *,void * *,void * *,struct OCIType * *)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected]@Z) referenced in function "bool __cdecl dump_object(struct OCIEnv *,struct OCIError *,struct OCISvcCtx *,void *,void *,void *)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected])

Commenting only those two APIs fixes the linker error. I made sure that nothing in project is changed apart from adding the two OCIObjectGetAttr and OCIObjectSetAttr API calls. Other OCIObject* APIs are linking. dumpbin /exports oci.lib shows that OCIObjectGetAttr and OCIObjectSetAttr are exported from the oci.lib.

What am I missing?

Stuck with this for quite a while. Google/Community search hasn't helped either.

Please help.

Thanks in advance,

Bikram

Tagged:

Best Answer

  • CBikram
    CBikram Member Posts: 5
    Answer ✓

    Seems to be a bug in orid.h, the following got me going. I was trying to link from C++ where as orid.h is missing the standard extern "C" block for linking from C++ like other oci header files.

    Wrapping the content of orid.h within the following got me successfully compiling.

    #ifdef __cplusplus

    extern "C" {

    #endif

    ...

    #ifdef __cplusplus

    }

    #endif /* __cplusplus */

    Hope Oracle fixes it in their next instant client release .

Answers

  • Error LNK2019 has been noticed in many of the situations and most of them are pointed to solution provided in below note-

    LNK2019: unresolved external symbol (Doc ID 1476844.1)


    Please try this, if it helps.

  • CBikram
    CBikram Member Posts: 5

    Thanks for replying. But I can't access the link you posted. Its taking me to Registration Page asking for "Support Identifier". If you have access to, a publicly accessible link would be more helpful.

  • CBikram
    CBikram Member Posts: 5

    @gprasad-Oracle

    A friend of mine helped me to get the content of the link you shared. The link talks about VS solution architecture configuration mismatch which never was my case since I am always building for x64. Besides, in case of a architecture mismatch all the API should link fail (as described by your link) and not just only particular two.

    But thanks again for trying to help me.

  • CBikram
    CBikram Member Posts: 5

    UPDATE:

    Since I have never tried to build a x86 version, I tried to check if the problem exists with oci.lib 32bit too -- and it does.

  • CBikram
    CBikram Member Posts: 5
    Answer ✓

    Seems to be a bug in orid.h, the following got me going. I was trying to link from C++ where as orid.h is missing the standard extern "C" block for linking from C++ like other oci header files.

    Wrapping the content of orid.h within the following got me successfully compiling.

    #ifdef __cplusplus

    extern "C" {

    #endif

    ...

    #ifdef __cplusplus

    }

    #endif /* __cplusplus */

    Hope Oracle fixes it in their next instant client release .

This discussion has been closed.
developers