Thread: using VC6 link VC7 static lib error

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    1,579

    using VC6 link VC7 static lib error

    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,

    Code:
    int foo()
    {
    	return 2008;
    }
    Here is the header of the lib file,

    Code:
    int foo();
    Here is the application using the static lib,

    Code:
    #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,

    Code:
    --------------------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

  2. #2
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    AFAIK you cannot mix 2003 and VC6 libraries. And I know for sure you cannot mix 2005 and VC6 - after many headaches and bottles of Advil.

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Thank you Bubba!


    Quote Originally Posted by Bubba
    AFAIK you cannot mix 2003 and VC6 libraries. And I know for sure you cannot mix 2005 and VC6 - after many headaches and bottles of Advil.
    What is the internal reason (compiler/linker/C Runtime Library/C++ Runtime Library) why we can not mix them?


    regards,
    George

  4. #4
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    It's a long story. Check the docs with MSVC which will lead you to a huge discussion concerning mixed assemblies on MSDN.

  5. #5
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Thank you Bubba!


    Quote Originally Posted by Bubba
    It's a long story. Check the docs with MSVC which will lead you to a huge discussion concerning mixed assemblies on MSDN.
    Could you provide an URL please? I am interested in this point.


    regards,
    George

  6. #6
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    I reckon starting at www.msdn.com might help.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Avoiding Global variables
    By csonx_p in forum Windows Programming
    Replies: 32
    Last Post: 05-19-2008, 12:17 AM
  2. error: template with C linkage
    By michaels-r in forum C++ Programming
    Replies: 3
    Last Post: 05-17-2006, 08:11 AM
  3. Why wont my function exit correctly?
    By LightsOut06 in forum C Programming
    Replies: 2
    Last Post: 10-09-2005, 09:23 PM
  4. C++ compilation issues
    By Rupan in forum C++ Programming
    Replies: 1
    Last Post: 08-22-2005, 05:45 AM
  5. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM