简体   繁体   English

您如何找到哪个.lib文件与哪个函数一起使用?

[英]How do you find which .lib file goes with which function?

In the linker settings you should tell the compiler which .lib files to include. 在链接器设置中,您应该告诉编译器要包括哪些.lib文件。 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? 我尚未弄清的一件简单的事情是,在使用第三方软件时如何知道哪个函数在哪个.lib文件中?

Example: I was recently using Qt which has a huge number of .lib files. 例子:我最近使用的Qt有大量的.lib文件。 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. 我以为该信息会在Qt的文档中找到,但找不到。 I am still a beginner teaching myself so sometimes easy things like this pass me by. 我仍然是一个自学成才的初学者,因此有时诸如此类的简单事情会绕过我。

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.) 第一种选择是阅读第三方库的文档(Microsoft非常擅长于此-它们在每个函数中都包含您需要的库和标头。看来Qt不太好。)

The second option is to list the names in each library with DUMPBIN as described here . 第二个选项是描述列出与DUMPBIN每个库的名字在这里

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. 如注释中所述,第二个选项的一种变体是grep .lib文件,以获取函数名称的纯文本。 That will tell you which .lib files either define the function, or call it. 这将告诉您哪些.lib文件定义了该函数或对其进行了调用。 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. 如果不止一个,则必须在所有返回的文件上运行DUMPBIN,以查看对其进行了定义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何正确指定哪个函数来自哪个文件? - How to properly specify which function goes from which file? 当我使用第三方库时,如何找出我需要链接的 lib 文件? - How to find out which lib file I need to link while I use a third party library? 如何找出成员函数所属的类 - How do I find out which class a member function belongs to 如何声明一个函数,您可以在其中通过引用传递多维数组 - How do you declare a function in which you pass a multidimensional array by reference 如何在与打开窗口不同的功能中使用绘制功能? - how do you use a draw function in a different function to the one in which the window was opened? 如何从调用原始函数的自定义函数中获取错误? 你有更好的建议吗? - How to get error from custom function which calls orginal function? do you have better suggestion? 如何找出二维数组元素位于哪个子网格中 - How do you find out in which sub-grid a 2D array element is located 您如何找出哪个.dylib文件包含某些增强功能 - How can you find out which .dylib file contains a certain boost functionality 如何找到打开插座的功能? - How to find which function opened the socket? 你如何编写一个 function 来返回一个节点,该节点的值对应于存储在变量中的值? - How do you write a function that returns a node which value corresponds to a value stored in a variable?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM