c - Not sure why I am getting an undefine refence to gss_str_to_oid error -


i using gssapi in c first time. trying reconstruct example on oracle doc http://docs.oracle.com/cd/e19683-01/816-1331/sampleprogs-1/index.html. in .c file call gss_str_to_oid(&min_stat, &tok, oid); , undefined reference error. included #include "gssapi.h" @ top of .c file. in gssapi.h there function call

om_uint32 krb5_callconv gss_str_to_oid(     om_uint32 *,        /* minor_status */     gss_buffer_t,       /* oid_str */     gss_oid *);  

so doing wrong? thought if included #include "gssapi.h" give me access function in gssapi. both files in src folder. doing wrong. using eclipse , in makefile under targets says all: gss-api. including of code below.

main

#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <error.h> #include <sys/stat.h> #include <fcntl.h>  #include "gssapi.h" #include "gssapi_ext.h" #include "gss-misc.h"  /* global mech oid needed display status, , acquire cred */ file *display_file; gss_oid g_mechoid = gss_c_null_oid;   void usage() {      fprintf(stderr, "usage: gss-client [-port port] [-d]"                         " [-mech mechoid] host service msg\n");      exit(1); }  static void parse_oid(char *mechanism, gss_oid *oid) {     char        *mechstr = 0, *cp;     gss_buffer_desc tok;     om_uint32 maj_stat, min_stat;      if (isdigit(mechanism[0])) {         mechstr = malloc(strlen(mechanism)+5);         if (!mechstr) {             printf("couldn't allocate mechanism scratch!\n");             return;         }         sprintf(mechstr, "{ %s }", mechanism);         (cp = mechstr; *cp; cp++)             if (*cp == '.')                 *cp = ' ';         tok.value = mechstr;     } else         tok.value = mechanism;     tok.length = strlen(tok.value);       maj_stat = gss_str_to_oid(&min_stat, &tok, oid);     if (maj_stat != gss_s_complete) {  //       display_status("str_to_oid", maj_stat, min_stat);         return;     }     if (mechstr)         free(mechstr); }  int main(argc, argv)      int argc;      char **argv; {     /* char *service_name, *hostname, *msg; */      char *msg;      char service_name[128];      char hostname[128];      char *mechanism = 0;      u_short port = 4444;      int use_file = 0;      om_uint32 deleg_flag = 0, min_stat;       display_file = stdout;       /* parse arguments. */       argc--; argv++;      while (argc) {           if (strcmp(*argv, "-port") == 0) {                argc--; argv++;                if (!argc) usage();                port = atoi(*argv);            } else if (strcmp(*argv, "-mech") == 0) {                argc--; argv++;                if (!argc) usage();                mechanism = *argv;            } else if (strcmp(*argv, "-d") == 0) {                deleg_flag = gss_c_deleg_flag;           } else if (strcmp(*argv, "-f") == 0) {                use_file = 1;           } else                 break;           argc--; argv++;      }      if (argc != 3)           usage();       if (argc > 1) {                 strcpy(hostname, argv[0]);         } else if (gethostname(hostname, sizeof(hostname)) == -1) {                         perror("gethostname");                         exit(1);         }        if (argc > 2) {         strcpy(service_name, argv[1]);         strcat(service_name, "@");         strcat(service_name, hostname);       }        msg = argv[2];       if (mechanism)          parse_oid(mechanism, &g_mechoid);  /*     if (call_server(hostname, port, g_mechoid, service_name,                    deleg_flag, msg, use_file) < 0)           exit(1);*/  /*      if (g_mechoid != gss_c_null_oid)          (void) gss_release_oid(&min_stat, &gmechoid); */       return 0; } 

gssapi.h

/* new v2 */ om_uint32 krb5_callconv gss_str_to_oid(     om_uint32 *,        /* minor_status */     gss_buffer_t,       /* oid_str */     gss_oid *);   

you can't include header have link library either dynamically or statically. there dll, lib, so, etc need add project? without makefile or project setup been shown in question; think not receive clear answer. including header file isn't enough, undefined not compilation error linker error, means missing reference because not linking library program.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -