c++ - Visual Studio solution with different projects with functions of the identical name -
i have vs10 solution contains 2 projects have functions of identical name. linker complains (throws warnings) second definitions (of 2 functions of same name) getting ignored:
warning lnk4006: "void __cdecl function_name(short *,class bbox *,int,int,struct file_names *,unsigned char *)" (?function_name@@yaxpafpavbbox@@hhpaufile_names@@pae@z) defined in xxx.lib(segment.obj); second definition ignored
this causes calls functions of second project (the ignored one) point function of first project (since definitions ignored).
my question is: there way avoid/resolve issue, other renaming functions have same name in 2 projects? example, adding #if/pragma header files, or manipulating .obj files. reality solution needs 1 of 2 projects in compilations, easy way conditional compilation fine, first preference have both projects compiled together.
this violates one definition rule states one definition of tempate, type, function or object may exist in entire program. resolve problem either make signature of both functions unique ether name or parameter overload, place them in different namespaces or use conditional compiling if require both libraries @ same time.
Comments
Post a Comment