Usenet.com

www.Usenet.com

Group Index

Comp Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: undefined reference to _GC_malloc



I tried to set up projects such that this error shows. However I'm not able
to repeat it. All works as expected here. Here's my example static library
source:
#include <gc.h>
#include <string.h>


char * MyStrDup(char* str){
 char *result = GC_MALLOC(strlen(str) + 1);
 strcpy(result, str);
 return result;
}

linked against gc.lib

and this is the project which used that library:
#include <gc.h>
#include <stdio.h>

extern char* MyStrDup(char*);

int main (void){
 char *tstr = MyStrDup("I'm a string");
 printf("tstr = %s\n", tstr);
 GC_FREE(tstr);
 return 0;
}
linked against strdup.lib and gc.lib
Both projects do need gc.lib. Is that the same as you setup?

Regards
Friedrich





<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.