the following code produces this error:
error LNK2019: unresolved external symbol "char const * __cdecl nameOnly(char const *)"
Code:
const char* nameOnly(const char* namewpath)
{
    const char* res = namewpath + strlen(namewpath);
    while (res > namewpath) {
        const char* tmp = res - 1;
        if (*tmp == '/' || *tmp == '\\') break;
        --res;
    }
    return res;
}
the above code is a plain c file and I'm compiling it with visual-C++. I don't get this error, when compiling with C-compiler.
UPDATE:
I have tried using extern:
extern "C"{ 
 const char* nameOnly(const char* namewpath)
 {
    ...
    }
    return res;
 }
}
and I get this error:
error C2059: syntax error : 'string'
 
     
     
    