using VC6 link VC7 static lib error  
Author Message
George2





PostPosted: Visual C++ Language, using VC6 link VC7 static lib error Top

Hello everyone,


I use VC 7 (Visual Studio.Net 2003) created a static lib, then I use VC6 to link with it in an application, there are some errors during link. Here is the source file of the lib,

int foo()
{
return 2008;
}

Here is the header of the lib file,

int foo();

Here is the application using the static lib,


#include "foo.h"

int main()
{
int a = foo();

return 0;
}

When building the lib using VC7, there are no errors and the static lib is generated. When building the application and link it with the static lib, there are errors,


--------------------Configuration: VC6VC7lib - Win32 Debug--------------------
Linking...
VC7_static_lib.lib(foo.obj) : fatal error LNK1190: invalid fixup found, type 0x000C
Error executing link.exe.

VC6VC7lib.exe - 1 error(s), 0 warning(s)

I can not find any useful information from MSDN. Could anyone help please -- how to use VC6 link a static library generated by VC7


thanks in advance,
George



Visual C++9  
 
 
Nishant Sivakumar





PostPosted: Visual C++ Language, using VC6 link VC7 static lib error Top

You cannot and should not try to mix static libs built in different compiler versions. For a VC6 app, use a static lib that was compiled with VC6, and similarly for VC 7.1 and 8.

 
 
George2





PostPosted: Visual C++ Language, using VC6 link VC7 static lib error Top

Thank you Nishant!

You cannot and should not try to mix static libs built in different compiler versions. For a VC6 app, use a static lib that was compiled with VC6, and similarly for VC 7.1 and 8.

I agree with you that it is a best practice, but in my environment, I should use VC6 to develop application, but other people (due to non-technical reasons) can only provide static lib built in VC7. So, I have to ...

Anyway, I think it is not a bad idea to ask them to use VC6 or I should change to VC7. I have a further question, what is the root cause of this issue By compiler or by something Why

regards,

George