I am a newbie to C & C++ and I am in desperate need of help. I want to re-use the functionality already coded by a vendor. For this, Vendor gave me the .H
files & .lib
files. Vendor code was developed in Visual C langage and I am trying to access those .lib files in Visual C++ 6. Compilation is successful. I get errors while linking. Steps taken:
- I have linked all the
.lib
files under the project settings.
I still get the following error message:
pricing_w32.obj : error LNK2001: unresolved external symbol
_open_item_info_files
Debug/pricing_w32.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe.
Below is the code which i had written:
#include<stdio.h>
#include<string.h>
#include<fstream>
#include<conio.h>
#include<stdlib.h>
#include<iostream>
#include <windows.h>
extern "C"
{
#include<cma_telx.h>
}
using namespace std;
int process_file(char **in_file);
extern "C"
{
void lkup_item_info( void *item );
int open_item_info_files( int *err );
int close_item_info_files( int *err );
int open_item_promo_files( int *err );
int close_item_promo_files( int *err );
void lkup_rtn_csp_db( void *itemCspWDB );
void lkup_rtn_promos_csp_db( void *itemPrmCspWDB );
int do_empdisc_lookup( struct EMPDISC_RECORD *edisc, int *err );
int do_empauth_lookup( struct EMPLOYEE_AUTH_REC *eauth, int *err );
void return_all_promos(struct ALL_PRMINFO_BASE &all_promos);
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
char UPC[7];
void *SKU;
cout<<"Normal end"<<endl;
int return_code, *err;
return_code = open_item_info_files(err);
cout<<return_code<<"open item return code"<<endl;
cout<<return_code<<"Close item return code"<<endl;
return 0;
}
cma_telx.h contains the following function prototype:
int open_item_info_files( int *err );
Below is snippet of the command: dumpbin /symbols cma_telx.lib
076 00000000 SECT1D notype () External | ?open_item_info_files@@YAHPAH@Z (int __cdecl open_item_info_files(int *))
tag index 00000083 size 00000121 lines 00007129 next function 0000008E
078 00000000 SECT1E notype Static | .data
Section length 9, #relocs 0, #linenums 0, checksum 145249B4, selection 2 (pick any)
07A 00000000 SECT1E notype External | ??_C@_08OOCA@PMSDPTCL?$AA@ (string')
07B 00000000 SECT1F notype Static | .data
Section length 7, #relocs 0, #linenums 0, checksum 7F8A6B53, selection 2 (pick any)
07D 00000000 SECT1F notype External | ??_C@_06CPCO@TSITEM?$AA@ (
string')
07E 00000000 SECT20 notype Static | .data
Section length 7, #relocs 0, #linenums 0, checksum F397CDFF, selection 2 (pick any)
080 00000000 SECT20 notype External | ??_C@_06OHCH@KPXREF?$AA@ (`string')
081 00000000 UNDEF notype () External | _imp_FileManager
082 00000000 UNDEF notype () External | __chkstk