问题
In C++ Builder when I compile I get
[ilink32 Error] Error: 'C:\PATH\TO\A\LIB\INCLUDED\IN\THE\PROJECT\ALIBRARY.LIB' contains invalid OMF record, type 0x21 (possibly COFF)
When I convert .lib with utilities coff2omf
, new lib looses significant functions.
回答1:
C++Builder cannot use .lib files from other compilers, only its own.
If the .lib file is an import lib for a DLL, use C++Builder's command-line IMPLIB tool to create a new .lib file from the DLL directly.
If the .lib file is a static library (containing actual code), C++Builder's command-line COFF2OMF tool MAY be able to convert the library, but it is not guaranteed. It really depends on what kind of code the library is actually using. If the conversion is not possible, you will have to wrap the .lib file into a DLL that is written in the same compiler that created the .lib file. Then you can use the DLL in C++Builder.
来源:https://stackoverflow.com/questions/17694860/linker-error-contains-invalid-omf-record