Gagan, malloc's return type needs to be type casted. See here for more info: http://stackoverflow.com/questions/5099669/invalid-conversion-from-void-to-char-when-using-malloc
Stack overflow is the best resource for programmers :D I think you mentioned you were familiar with Python so this is similar to a TypeError. You might as well put the typecast in there for good measure so it plays nice with g++. I bet if you compile with gcc instead, it doesn't complain about it. - Swyped from my droid. On Apr 29, 2013 5:41 AM, "gagan" <thegag...@gmail.com> wrote: Though through make and make check all file get compiled. I was trying to compile only test.c file using g++ and I got this error :- gagan@geek:~/projects/libredwg/examples$ g++ test.c In file included from test.c:23:0: suffix.c: In function ‘char* suffix(const char*, const char*)’: suffix.c:34:25: error: invalid conversion from ‘void*’ to ‘char*’ [-fpermissive] -------------------------------- suffix.c file ---------------------- char * suffix (const char *filename, const char *ext) { char *copy = strdup (filename); char *base = basename (copy); int len = strlen (base) + 1 + strlen (ext) + 1; char *rv = malloc (len); //error seems to be here char *dot; if ((dot = strrchr (base, '.')) && dot + 4 < base + len && !strncmp (1 + dot, "dwg", 3)) *dot = '\0'; snprintf (rv, len, "%s.%s", base, ext); free (copy); return rv; } --------------------------------------------------------------------------- Any ideas why this error is coming ? How to solve this error ? -- Thanks Gaganjyot