"error LNK2001: unresolved external symbol"

This question already has an answer here:

  • What is an undefined reference/unresolved external symbol error and how do I fix it? 27 answers

  • I think the problem is with the 'extern' keyword. That keyword specifies that those values be declared somewhere else in your code. Perhaps you're missing another .c/.cpp file to compile which contains the declarations of those variables. Again, your inclusion of this header file isn't actually defining any variables -- it's just requiring that they exist somewhere else!


    You've included the header but not the required library (implementation of those extern objects).

    what is this library? did you download it from the web (some open source)? if yes, check that web site for .lib files (the library)


    I just want to throw this out there for others who might stumble upon this post in the future.

    At work I am currently upgrading projects from vs2010 (or later) to vs2012 and I happened upon this error in one of the projects. For some reason I decided to rearrange my additional dependencies in Linker -> Input -> Additional Dependencies and it fixed my error.

    I don't know what changed with the linker from 2010 to 2012 but apparently it required a rearrangement of the .lib's that I was depending on.

    It may not be common but if you're having this problem and there are many external dependencies it is easy enough to try this: just put the dependency that is raising this error to the end of the list and rebuild the project.

    Hopefully this helps someone someday! Happy Coding!

    链接地址: http://www.djcxy.com/p/73316.html

    上一篇: 为什么可执行文件不可执行?

    下一篇: “错误LNK2001:无法解析的外部符号”