Linker error "contains invalid OMF record"

13.3k views Asked by At

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.

2

There are 2 answers

0
Remy Lebeau On

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.

0
Jitendra On

I was facing the same issue. I have used the tool COFF2OMF to covert the existing lib files to make them compatible with C++Builder. It works for me. Syntax:

..Embarcadero/../bin> COFF2OMF libssl.lib alibssl.lib

..Embarcadero/../bin> COFF2OMF libcrypto.lib alibcrypto.lib

Renamed the converted files and placed them in the required location.