Hi guys,

i am having some problm while building my C code through VC++6.0. The following error i am getting while building:

--------------------Configuration: ReportVARS - Win32 Debug--------------------
Linking...
ReportVARS.obj : error LNK2001: unresolved external symbol _BTRV@24
PHCLUST.OBJ : error LNK2001: unresolved external symbol _BTRV@24
BTRVUTIL.OBJ : error LNK2001: unresolved external symbol _BTRV@24
Debug/ReportVARS.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.


pls help me if any to get it resolve.


-----ishwar

Dani AI

Generated

Short, practical checklist to finish this link step (builds on and ):

  • Confirm the symbol’s origin. If the function is in your sources, make sure the .c that defines it is compiled and its .obj is linked. If the function is supplied by a vendor runtime (the Btrieve-style runtime noted earlier), you must link that vendor import library or call the DLL at runtime.

  • Match calling conventions and C linkage. The decorated name _BTRV@24 means the caller expects a stdcall symbol (24 bytes of args). If your prototype is missing `stdcallor is being compiled as C++ withoutextern "C"`, the linker name won’t match. Example header pattern:

    #ifdef __cplusplus
    extern "C" {
    #endif
    
    int __stdcall BTRV(/* correct parameters */);
    
    #ifdef __cplusplus
    }
    #endif
  • Inspect exports and references. Use the Visual Studio tools to see what’s actually exported and what your objects reference:

    dumpbin /exports vendor.dll
    dumpbin /symbols BTRAPI.obj | find "BTRV"

    If the DLL has only decorated exports, use those exact names with GetProcAddress or create an import library.

  • Create an import lib (when you have only a DLL). Make a small .def with an EXPORTS section listing the exported names (copy from dumpbin /exports) and run:

    lib /def:exports.def /out:vendor.lib /machine:IX86

    Then add that .lib to your project (Project -> Settings -> Link -> Object/library modules in VC6).

  • Alternative: load the DLL dynamically:

    HMODULE h = LoadLibrary("vendor.dll");
    if (h) {
      typedef int (__stdcall *BTRV_t)(/*...*/);
      BTRV_t p = (BTRV_t)GetProcAddress(h, "_BTRV@24"); // or plain name from dumpbin
      if (p) p(/*args*/);
      FreeLibrary(h);
    }

Cautions: ensure all objects/libs are built for the same machine (x86 vs x64) and that import libraries come from a compatible toolchain. If these steps don’t solve it, locate the vendor SDK/import library or ask the vendor for the redistributable import library — that is the usual final fix.

Recommended Answers

All 10 Replies

You need to find out where the function BTRV is defined and then link to that library or object file.

its defined in BTRAPI.C program,......but i dont hav any library file/.obj file for the same and compilation of this BTRAPI.C file is successful but while building it...its throwing the same error.

pls suggets....

----ishwar

Is BRTAPI.c present in the same VC++ project as your other files ReportVARS.c , PHCLUST.c and BTRVUTIL.c ?

yes....i have included this file in ma proj.....thn after its throwing this error::

Deleting intermediate files and output files for project 'ReportVARS - Win32 Debug'.
--------------------Configuration: ReportVARS - Win32 Debug--------------------
Compiling...
ReportVARS.c
VALIDATE.C
ALLOC.C
BASENAME.C
BTRVUTIL.C
COBLUTIL.C
C:\Documents and Settings\IVarma\Desktop\kunda\FINALCODE\COBLUTIL.C(98) : warning C4244: '=' : conversion from '__int64 ' to 'long ', possible loss of data
C:\Documents and Settings\IVarma\Desktop\kunda\FINALCODE\COBLUTIL.C(116) : warning C4244: '=' : conversion from '__int64 ' to 'long ', possible loss of data
C:\Documents and Settings\IVarma\Desktop\kunda\FINALCODE\COBLUTIL.C(191) : warning C4244: '=' : conversion from '__int64 ' to 'long ', possible loss of data
C:\Documents and Settings\IVarma\Desktop\kunda\FINALCODE\COBLUTIL.C(208) : warning C4244: '=' : conversion from '__int64 ' to 'long ', possible loss of data
CPPPORT.C
DATE.C
FATAL.C
GETOPT.C
LEAPYEAR.C
LOG_DIAG.C
LOWERCAS.C
MISC.C
MONTHDAY.C
PHCLUST.C
REPORT.C
SKIPWHIT.C
STATUS.C
TODAY.C
TRUNC.C
UPPERCAS.C
BTRAPI.C
Linking...
BTRAPI.OBJ : error LNK2001: unresolved external symbol _WBRQSHELLINIT@4
BTRAPI.OBJ : error LNK2001: unresolved external symbol _BTRCALL@28
BTRAPI.OBJ : error LNK2001: unresolved external symbol _BTRCALLID@32
Debug/ReportVARS.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.


PLS LOOK INTO THIS..


;---ISHWAR

Well since I don't have access to your code files, I don't know where all the functions are defined.

The first rule of being able to link correctly is that, you need to resolve ALL of your function references.

As you can clearly see you have not resolved the references to WBRQSHELLINIT, BTRCALL and BTRCALLID which are defined in BTRAPI.c

I would suggest for the sake of simplicity that you include all the necessary files in your current project.

Another option is to create a static library and put the source files for the functions you are using in there, compile that and link it to your main code.

Can i get WBTRCALL.LIB from somewhere ?? bcoz it includes those fxns what error is reflecting here.
any idea pls suggest!!


----ishwar

Have you tried doing a search for it on your system(s) ?

yep!...i hav trie on net....but its not thr??/,.......so m askin u guys.......??
if possiblee.......
well anyways ....if i get this .lib file .....ma prblm maight get solve ......i guesss!!
;)

If its not a standard windows library file, you need to know what software or package its in the context of, and locate it accordingly. Just finding that one library may not fix your link errors.. there may be other symbols in there which may be referenced in other libraries related to the software or package.

Hi guys,

i am having some problm while building my C code through VC++6.0. The following error i am getting while building:

--------------------Configuration: ReportVARS - Win32 Debug--------------------
Linking...
ReportVARS.obj : error LNK2001: unresolved external symbol _BTRV@24
PHCLUST.OBJ : error LNK2001: unresolved external symbol _BTRV@24
BTRVUTIL.OBJ : error LNK2001: unresolved external symbol _BTRV@24
Debug/ReportVARS.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.


pls help me if any to get it resolve.


-----ishwar

Hi folks,
just saw your posts here and found that we had similar problems (years ago). The missing functions are Btrieve related. That is a database sold by Pervasive (www.pervasive.com). In early versions (Btrieve 6.x) there was a wide spread use of them but since they are no unlimited version available most companies moved along. So if you want to compile your program you either can get a current version (including the wbtrv32.dll - that contains all your missing functions) by searching for Pervasive SQL or you replace your Btrieve related function using one of the available wrapper solutions where you can use what ever you want as a database (check www.dbcoretech.com and search for Btrieve).

cheers.... Tebone

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.