ld.exe: DWARF error: could not find variable specification at offset 101cee

Viewed 10403

I get massive output with the following message (differentiated only by hex address):

ld.exe: DWARF error: could not find variable specification at offset 101cee

What is the meaning of this error in general?

This does not happen when compile release build. Only debug build.

1 Answers

Basically I just found the solution. I place it here, because I didn't found such question in StackOverflow. Please answer if something of my positions are wrong.

I compile a library as a static library, but without correct #define directive, all exported functions get a __declspec(dllexport) prefix. So names of function function became __imp_function.

So, it was just an undefined reference to __imp_function.

But why it is so encrypted? And why release build compiled correctly?

I believe that this happen because of -flto option which does link time optimization and keep all the code of library inside .a file, so, no references needed (no fail).

Related