I changed my calling convention to stdcall and am still getting errors (different from when I had cdecl). Sorry, here they are:
Building addndx.exe.
POLINK: error: Symbol '_cb_prints@4' is multiply defined: 'C:\Users\pekar\Documents\Pelles C Projects\addndx\output\ADDNDX.obj' and 'cbt.lib(w32io.obj)'.
POLINK: error: Unresolved external symbol '_stricmp'.
POLINK: error: Unresolved external symbol '__imp__timeGetTime@0'.
POLINK: fatal error: 2 unresolved external(s).
*** Error code: 1 ***
Done.
My source code for addndx (included here) does not have a 'cb_prints'.
Ok... looking at your source there are a number of problems...
First, the setup of it is terrible... don't just jam everything up together... set it up in a clear and easly readable manner... like this...
#include "isam.h"
#pragma lib "isam.lib"
#pragma lib "cbt.lib"
int i;
char source[129]= "";
char message[129];
#include "tools.c"
main(int argc, char *argv[])
{
Db_Obj *db;
if (argc < 4)
{
printf("\nMust have at least 3 parameters to create index");
exit(-3);
}
for (i = 0; i < argc; i++)
{
strcat(source,argv[i]);
strcat(source," ");
}
argv[argc]=NULL;
db=iopen_db(argv[2]);
if (db == NULL)
{
printf("\ndatabase %s not found, cannot create index", argv[2]);
exit(-1);
// abortx(message);
}
if (imkindex(db, argv[1], &argv[3]) == I_ERROR)
{
iprterr();
printf("\nindex %s could not be created", argv[1]);
exit(-2);
// abortx(message);
}
else printf("index created successfully");
}
For the code itself...
It's
int main (int argc, char* argv[]) and it returns a value to the operating system at the end usually
return 0; ... and yes it matters... that's how the OS knows if your program succeeded or had errors.
Do not #include .c files ... make a header (.h file) with the functions you want to import.
You are using several functions without the correct headers... strcat() for one... #include <string.h> ... this probably explains most of the unresolved externals.
You are including cbt.lib with no header to import functions. The linker will not find references to it's functions in your code and will not include it.
For the duplicated identifier I'm betting it's either in that tools.c file you're including directly into your source or it's referenced by it. (This by the way is why we make header files!)