0

In the linker settings you should tell the compiler which .lib files to include. One simple thing that I haven't figured out is how to know which function is in which .lib file when using 3rd party software?

Example: I was recently using Qt which has a huge number of .lib files. After trying those with most obvious names, I had to go through them all by trial and error until I found the correct one. I thought this information would be in the documentation of Qt but failed to find it. I am still a beginner teaching myself so sometimes easy things like this pass me by.

Beetroot
  • 701
  • 6
  • 12

1 Answers1

1

There are two basic approaches.

The first option is to read the documentation for the third party library (Microsoft is very good at this - they include the library and header you need in each function. It seems Qt is not so good.)

The second option is to list the names in each library with DUMPBIN as described here.

As noted in the comments, a variant of the second option is to grep the .lib files for a the plain text of the function names. That will tell you which .lib files either define the function, or call it. If there is only one, you are done; if more than one, you will have to run DUMPBIN on all the returned files to see which defines it.

Community
  • 1
  • 1
  • yes of course we can run `link.exe -dump /EXPORTS "somelib.lib" > somelib.log` for every `somelib.lib` but what if we have many libs ? do this for every ? function name containing in lib file in plain text as is (may be decorated - extra symbols at begin and end, but root as is. so fastest and easy way - simply search files, contacting `somefunc` name (case sensitive) – RbMm Mar 05 '17 at 12:10
  • Yes, do it for every lib. I feel nervous about searching binary code for text. (Yes, yes, I know it works - it just doesn't feel clean to me.) Also note that the text will appear if the .lib *calls* the function, rather than *defines* it. – Martin Bonner supports Monica Mar 05 '17 at 12:13
  • we need search plain text (function name) as is. usual all lib placed in same folder. so search all *.lib files with text `myfunction` - work very fast and easy. if will be more than 1 result (rarely) - already can more detail look for founded libs – RbMm Mar 05 '17 at 12:17