c - error LNK2019 unexplainable when trying to port openldap to windows -
Text after "itemprop =" text ">
I have a CMake project created in Visual Studio 2005 after creating an LDAP Abstract API on my project Linux Having worked on Windows XP I'm trying to work on windows in some way.
I have found an unusual linking error of the LNK 2019 type
code:
main .obj: error LNK2019: symbole foreign non résolu _strcpy reference dowry La fonction _menu
This function is in my main.c and adding error is coming from my other file LDAP. The ones that are load_values_from_attr () are function codes:
/ **** / static int16 load_values_from_attr (t_LdapSearchContext ctx, uint32 result_max_count, LDAP * ld, LDAPMessage * result_message, BerElement * ptr) {UINT16J = 0; UINT16i = 0; Char * str_attr; Straight barval ** straw_wale; Str_attr = ldap_first_attribute (LD, result_message, & amp; ptr); If (str_attr == NULL) back 1; Str_values = ldap_get_values_len (ld, result_reference, str_attr); Strcpy (ctx.attributions [i] .attrs, str_attr); While (str_values [j] = zero & amp; amp; j + 1 & lt; RESULT_WIDTH!) {Strncpy (ctx.attributs [i] .values [j + 1] .val, str_values [ J] -> bv_val, MAX_LENGTH); #ifdef WIN32 ber_bvfree (str_values [j]); // & lt; & Lt; & Lt; Here is my problem #endif j ++; } / **** /
When I can delete or queue with comment: ber_bvfree (str_values [j]); When I have an error in linking
, and leave it there, the program can be compiled and executed, but segfault (which is another story) on it. I can not understand why the linker is behaving this way, if someone can tell me some explanation, then I am Glade.
Do not hesitate to ask me more explanations.
Finally !! After working on the Linker option in Visual Studio, I understand that /NODEFAULTLIB:msvcrtd.lib was able, the link which could have been broken by the linker, the linker can correctly link different objects. I can still tell t why this option is adding trouble to my own object, usually included in NODEFAULTLIB:
NB (This option was looking at the LNK2001 linker problem in my code Is not enabled after doing well) msvcrtd .lib is used to disable the default library msvcrtd.lib inclusion.
I hope this will help someone
Comments
Post a Comment