• <i id='s3DGT'><tr id='s3DGT'><dt id='s3DGT'><q id='s3DGT'><span id='s3DGT'><b id='s3DGT'><form id='s3DGT'><ins id='s3DGT'></ins><ul id='s3DGT'></ul><sub id='s3DGT'></sub></form><legend id='s3DGT'></legend><bdo id='s3DGT'><pre id='s3DGT'><center id='s3DGT'></center></pre></bdo></b><th id='s3DGT'></th></span></q></dt></tr></i><div id='s3DGT'><tfoot id='s3DGT'></tfoot><dl id='s3DGT'><fieldset id='s3DGT'></fieldset></dl></div>
    1. <small id='s3DGT'></small><noframes id='s3DGT'>

      • <bdo id='s3DGT'></bdo><ul id='s3DGT'></ul>
      <tfoot id='s3DGT'></tfoot>

      1. <legend id='s3DGT'><style id='s3DGT'><dir id='s3DGT'><q id='s3DGT'></q></dir></style></legend>

        使用 VC++ 2008 编译引用 STLport-5.1.4 的应用程序时出现 LNK2001 错误

        LNK2001 error when compiling apps referencing STLport-5.1.4 with VC++ 2008(使用 VC++ 2008 编译引用 STLport-5.1.4 的应用程序时出现 LNK2001 错误)

            <small id='HfWaA'></small><noframes id='HfWaA'>

            <i id='HfWaA'><tr id='HfWaA'><dt id='HfWaA'><q id='HfWaA'><span id='HfWaA'><b id='HfWaA'><form id='HfWaA'><ins id='HfWaA'></ins><ul id='HfWaA'></ul><sub id='HfWaA'></sub></form><legend id='HfWaA'></legend><bdo id='HfWaA'><pre id='HfWaA'><center id='HfWaA'></center></pre></bdo></b><th id='HfWaA'></th></span></q></dt></tr></i><div id='HfWaA'><tfoot id='HfWaA'></tfoot><dl id='HfWaA'><fieldset id='HfWaA'></fieldset></dl></div>
            <tfoot id='HfWaA'></tfoot>

          1. <legend id='HfWaA'><style id='HfWaA'><dir id='HfWaA'><q id='HfWaA'></q></dir></style></legend>
              • <bdo id='HfWaA'></bdo><ul id='HfWaA'></ul>

                  <tbody id='HfWaA'></tbody>
                  本文介绍了使用 VC++ 2008 编译引用 STLport-5.1.4 的应用程序时出现 LNK2001 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我为长篇文章提前道歉...

                  I apologize in advance for the long post...

                  当我们在 VS 菜单 > 工具 > 选项 > VC++ 目录 > 包含和库文件的目录下列出 STLPort 包含和库目录时,我曾经能够构建我们的 VC++ 解决方案(我们在 VS 2008 上).但是,我们希望过渡到完全依赖 .vcproj 和 .sln 文件的构建过程.与必须在每台开发 PC 上单独配置的 VS 选项不同,这些可以签入源代码管理.我们通过将包含目录添加到每个项目的属性页 > 配置属性 > C/C++ > 常规 > 附加包含目录,并将库目录添加到链接器 > 常规 > 附加库目录来处理大多数库的转换.

                  I used to be able to build our VC++ solutions (we're on VS 2008) when we listed the STLPort include and library directories under VS Menu > Tools > Options > VC++ Directories > Directories for Include and Library files. However, we wanted to transition to a build process that totally relies on .vcproj and .sln files. These can be checked into source control unlike VS Options which have to be configured on each development PC separately. We handled the transition for most libraries by adding the Include directories to each Project's Property Pages > Configuration Properties > C/C++ > General > Additional Include Directories, and Library directories to Linker > General > Additional Library Directories.

                  不幸的是,这种方法不适用于 STLPort.我们在链接期间收到 LNK2019 和 LNK2001 错误:

                  Unfortunately, this approach doesn't work for STLPort. We get LNK2019 and LNK2001 errors during linking:

                  Error   1   error LNK2019: unresolved external symbol "public: virtual bool __thiscall MyClass::myFunction(class stlp_std::basic_istream<char,class stlp_std::char_traits<char> > &,class MyOtherClass &,class stlp_std::basic_string<char,class stlp_std::char_traits<char>,class stlp_std::allocator<char> > &)const " (?myFunction@MyClass@@UBE_NAAV?$basic_istream@DV?$char_traits@D@stlp_std@@@stlp_std@@AAVSbprobScenarioData@@AAV?$basic_string@DV?$char_traits@D@stlp_std@@V?$allocator@D@Z) referenced in function _main MyLibrary.obj   
                  
                  Error   5   error LNK2001: unresolved external symbol "public: static void __cdecl MyClass::myFunction(class stlp_std::basic_string<char,class stlp_std::char_traits<char>,class stlp_std::allocator<char> > const &,class stlp_std::basic_string<char,class stlp_std::char_traits<char>,class stlp_std::allocator<char> > const &,class stlp_std::basic_string<char,class stlp_std::char_traits<char>,class stlp_std::allocator<char> > const &,class stlp_std::basic_string<char,class stlp_std::char_traits<char>,class stlp_std::allocator<char> > const &,long,enum MyClass::MessageType,int,class stlp_std::basic_string<char,class stlp_std::char_traits<char>,class stlp_std::allocator<char> > const &)" (?myFunction@MyClass@@SAXABV?$basic_string@DV?$char_traits@D@stlp_std@@V?$allocator@D@stlp_std@@000JW4MessageTypeH0@Z)  MyLibrary.lib   
                  

                  在将可执行项目链接到库项目的依赖项时会发生这种情况.奇怪的是,在链接库项目本身时不会发生这种情况.有什么想法吗?

                  This happens while linking and executable project to dependencies which are library projects. Curiously, this does not happen while linking the library projects themselves. Any ideas?

                  推荐答案

                  Raymond Chen 最近在 旧的新事物——这些问题的一个原因是库是用一组开关编译的,但你的应用程序使用的是不同的开关.你需要做的是:

                  Raymond Chen recently talked about this at The Old New Thing-- one cause of these problems is that the library was compiled with one set of switches, but your app is using a different set. What you have to do is:

                  获取链接器正在寻找的确切符号.这将是一个可怕的混乱的名字.使用十六进制编辑器(IIRC,Visual Studio 将执行此操作)查看您要链接到的 .lib 文件.找到几乎是链接器正在寻找的符号,但不完全是.鉴于符号的差异,尝试找出哪些命令行开关会有所帮助.祝你好运——对于不习惯这类问题的人来说,解决方案可能需要几天时间才能弄清楚 (!)

                  Get the exact symbol that the linker is looking for. It will be a horrible mangled name. Use a hex editor (IIRC, Visual Studio will do this) to look at the .lib file you're linking to. Find the symbol that's almost the thing the linker is looking for, but not quite. Given the differences in the symbols, try to figure out what command line switches will help. Good luck -- for people who aren't used to this sort of problem, the solution can take days to figure out (!)

                  这篇关于使用 VC++ 2008 编译引用 STLport-5.1.4 的应用程序时出现 LNK2001 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  C++ stl unordered_map implementation, reference validity(C++ stl unordered_map 实现,参考有效性)
                  C++: Is it possible to use a reference as the value in a map?(C++:是否可以使用引用作为映射中的值?)
                  Where ampersand quot;amp;quot; can be put when passing argument by reference?(其中符号“amp;通过引用传递参数时可以放置吗?)
                  Why can a non-const reference parameter be bound to a temporary object?(为什么可以将非常量引用参数绑定到临时对象?)
                  What is a dangling reference?(什么是悬空引用?)
                  C++ reference changes when push_back new element to std::vector(当 push_back 新元素到 std::vector 时,C++ 引用发生变化)
                • <tfoot id='cwMDg'></tfoot>
                    <i id='cwMDg'><tr id='cwMDg'><dt id='cwMDg'><q id='cwMDg'><span id='cwMDg'><b id='cwMDg'><form id='cwMDg'><ins id='cwMDg'></ins><ul id='cwMDg'></ul><sub id='cwMDg'></sub></form><legend id='cwMDg'></legend><bdo id='cwMDg'><pre id='cwMDg'><center id='cwMDg'></center></pre></bdo></b><th id='cwMDg'></th></span></q></dt></tr></i><div id='cwMDg'><tfoot id='cwMDg'></tfoot><dl id='cwMDg'><fieldset id='cwMDg'></fieldset></dl></div>
                  1. <small id='cwMDg'></small><noframes id='cwMDg'>

                          <tbody id='cwMDg'></tbody>
                          <bdo id='cwMDg'></bdo><ul id='cwMDg'></ul>

                            <legend id='cwMDg'><style id='cwMDg'><dir id='cwMDg'><q id='cwMDg'></q></dir></style></legend>