[英]error LNK2019: unresolved external symbol referenced in function main
I'm using a library to generate multimodal optimization functions using VS2010. 我正在使用一个库来使用VS2010生成多模式优化功能。 I include the header file of the library and tell VS where the library directory is;
我包括库的头文件,并告诉VS库目录在哪里; however, there is no *.lib file that comes with it, just source files and header files, so I can't point VS to "Additional Library Directories".
但是,没有附带* .lib文件,只有源文件和头文件,因此我无法将VS指向“其他库目录”。
If I just include the header file and run my code it works fine. 如果我仅包含头文件并运行我的代码,它就可以正常工作。 If I call any method from that library I get the LNK2019 error:
如果我从该库中调用任何方法,则会收到LNK2019错误:
error LNK2019: unresolved external symbol "void __cdecl g_initialize(char *)" (?g_initialize@@YAXPEAD@Z) referenced in function main".
错误LNK2019:函数main中引用的未解析的外部符号“ void __cdecl g_initialize(char *)”(?g_initialize @@ YAXPEAD @ Z)。
I looked around and everyone is saying I should link the library, but I don't have a library file to begin with. 我环顾四周,每个人都在说我应该链接库,但是我没有库文件。 What should I do??
我该怎么办??
Regards, 问候,
There're 2 ways if you have implementation of those header files. 如果实现了这些头文件,则有两种方法。
1) You can add it to you project. 1)您可以将其添加到您的项目中。
2) To compile library yourself, and you will get *.lib files. 2)自己编译库,您将获得* .lib文件。 After this add it to you project.
之后,将其添加到您的项目中。
Read documentation of this library how to use it. 阅读该库的文档,了解如何使用它。 Also you can check if there's implementation methods/functions which declared in header files.
您也可以检查头文件中是否声明了实现方法/功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.