简体   繁体   English

错误LNK2019:函数main中引用了无法解析的外部符号

[英]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.

相关问题 错误LNK2019:函数中引用的未解析的外部符号“” - error LNK2019: unresolved external symbol “” referenced in function 错误LNK2019:函数_main visual c ++中引用的未解析的外部符号 - error LNK2019: unresolved external symbol referenced in function _main visual c++ 错误LNK2019:引用了无法解析的外部符号SHInitExtraControls? - error LNK2019: unresolved external symbol SHInitExtraControls referenced? 错误LNK2019:函数_wmain中引用的未解析的外部符号_CreateFastString - error LNK2019: unresolved external symbol _CreateFastString referenced in function _wmain C++:错误 LNK2019:未解析的外部符号 __snprintf 在函数中引用 - C++: error LNK2019: unresolved external symbol __snprintf referenced in function 错误 LNK2019:function 中引用的未解析外部符号 _Direct3DCreate9Ex@8“受保护:XYX()” - error LNK2019: unresolved external symbol _Direct3DCreate9Ex@8 referenced in function "protected: XYX()" 错误 LNK2019:未解析的外部符号 _WinMain@16 在 function ___tmainCRTStartup 中引用 - error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup 错误LNK2019:无法解析的外部符号 - error LNK2019: unresolved external symbol 错误LNK2019:无法解析的外部符号 - error LNK2019: unresolved external symbol error LNK2019: 未解析的外部符号 __imp____acrt_iob_func 在 function _printf 中引用 VS2019 - error LNK2019: unresolved external symbol __imp____acrt_iob_func referenced in function _printf in VS2019
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM