0

I am trying to compile a file named md5.c with xlC compiler this way:

cc md5.c

and it throws me an error that says

ld: 0711-317 ERROR: Undefined symbol: .main

Here I attach the md5.c file and as you can see there is no main in it (neither in the md5.h), so I don't know why I am getting that error

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include </home/inst6/sqllib/include/sqludf.h>
#include </home/inst6/sqllib/include/sqlca.h>
#include </home/inst6/sqllib/include/sqlda.h>
#include "md5.h"


/*--------------------------------------------------*/
/* MD5 Hashing                                      */
/*--------------------------------------------------*/

#ifdef __cplusplus
extern "C"
#endif
void SQL_API_FN md5_c(
SQLUDF_VARCHAR      *in,
SQLUDF_CHAR      out[33],
SQLUDF_SMALLINT  *innull,
SQLUDF_SMALLINT  *outnull,
SQLUDF_TRAIL_ARGS) {

char *t;

t = md5( in );
strcpy( out, t );
free( t );

*outnull = 0;
return;
}
0

You received that error exactly because there is no main function. You've asked the compiler to create an executable; an executable needs a main function. Perhaps you meant to tell the compiler to compile-only, using the -c option?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.