Hi , I m working on windows XP with visual studio 2005. My project is a Cmake project created after creating an LDAP abstraction API on linux.I m trying somehow to make it work on windows.
I've got an unusual linking error of type LNK2019
code :
main.obj : error LNK2019: symbole externe non résolu _strcpy référencé
dans la fonction _menu
it happens that this function is in my main.c and the linking error above is comming from my other file LDAP.C wich contain the load_values_from_attr() function code :
/****/
static INT16 load_values_from_attr(t_LdapSearchContext ctx,
UINT32 result_max_count, LDAP *ld, LDAPMessage *result_message,
BerElement *ptr)
{
UINT16 j=0;
UINT16 i=0;
char *str_attr;
struct berval **str_values;
str_attr=ldap_first_attribute(ld, result_message, &ptr);
if (str_attr == NULL) return 1;
str_values=ldap_get_values_len(ld, result_message, str_attr);
strcpy(ctx.attributs[i].attrs, str_attr);
while(str_values[j]!=NULL && j+1<RESULT_WIDTH)
{
strncpy(ctx.attributs[i].values[j+1].val,
str_values[j]->bv_val,MAX_LENGTH);
#ifdef WIN32
ber_bvfree(str_values[j]); // <<< here is my problem
#endif
j++;
}
/****/
When i delete or comment the line with : ber_bvfree(str_values[j]);
the Linking error happen, and when i leave it there , the program compil and can be executed but segfault on it (wich is another story).
I can t figure out why the linker is behaving this way , if anyboby can give me some explaination i ll be glade.
don't hesitate to ask me more explainations.