本文介绍了将函数与大型原型链接时链接器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编译和链接以使用 创建.dll文件VS命令行utlility

I am trying to compile and link to create a .dll file using  VS command line utlility

示例代码:

命名空间normalNS

{

 命名空间组织

  {

    namespace verylonglongnamenamespaceNMSP

{



void bigandlongClassNameGiven :: ReadFlow(const std :: string& flowName,

std ::向量< VeryBigDifferentName1>& obj1,

std :: vector< VeryBigDifferentName2>& obj2,

std :: vector< VeryBigDifferentName3>& obj3,

std :: vector< VeryBigDifferentName4>& obj4,

VeryBigDifferentName1& obj5,

std :: vector< ClName1>& ClName1,

normalNS :: org :: common :: ALittleBigClassName& resp



{

//这里不相关的代码

}



}

  }
}

namespace normalNS
{
  namespace org
  {
    namespace verylonglongnamespaceNMSP
{

void bigandlongClassNameGiven::ReadFlow(const std::string& flowName,
std::vector<VeryBigDifferentName1 >& obj1,
std::vector<VeryBigDifferentName2 >& obj2,
std::vector<VeryBigDifferentName3 >& obj3,
std::vector<VeryBigDifferentName4 >& obj4,
VeryBigDifferentName1& obj5,
std::vector<ClName1 >& ClName1,
normalNS::org::common::ALittleBigClassName& resp
)
{
//irrelevant code here
}

}
  }
}

这里的VeryBigDifferent *在同一名称空间中都是不同的类。

Here VeryBigDifferent* are all different class in the same namespace.

当我编译和链接时,我收到以下错误。

When i compile and link, i get the following error.

错误LNK2001:未解析的外部符号"public:virtual void __cdecl normalNS :: org :: verylonglongnamespaceNMSP :: bigandlo

ngClassNameGiven :: ReadFlow(class std :: basic_string< char,struct std :: char_traits< char>,class std :: allocator< char>> const&,class std :: vector

< class normalNS :: org :: verylonglongnamespaceNMSP :: VeryBigDifferentName1,class std :: allocator< class normalNS :: org :: verylonglongnamespaceNMSP ::

VeryBigDifferentName1>>&,class std :: vector< class normalNS :: org :: verylonglongnamespaceNMSP :: VeryBigDifferentName2,class std :: allocator< clas

s normalNS :: org :: verylonglongnamespaceNMSP :: VeryBigDifferentName2>>&,class std :: vector< class normalNS :: org :: verylonglongnamespaceNMSP :: Ver

yBigDifferentName3,类std :: allocator< class normalNS :: org :: verylonglongnamespaceNMSP :: VeryBigDifferentName3> > &,类std :: vector< class n

ormalNS :: org :: verylonglongnamespaceNMSP :: VeryBigDifferentName4,class std :: allocator< class normalNS :: org :: verylonglongnamespaceNMSP :: VeryBigD

ifferentName4> > &,class normalNS :: org :: verylonglongnamespaceNMSP :: VeryBigDifferentName1&,class ?? :: vector< class normalNS :: org :: verylonglo

ngnamespaceNMSP :: ClName1,class std :: allocator< class normalNS :: org :: verylonglongnamenameNMSP :: ClName1> > &,?? )throw(??)" (?ReadFlow @ big

andlongClassNameGiven @ verylonglongnamespaceNMSP @ org @ normalNS @@ UEAAXAEBV?$ basic_string @ DU?$ char_traits @ D @ std @@ V?$ allocator @ D @ 2 @@ std @@ AEAV?$ ve

ctor @VVeryBigDifferentName1 @ verylonglongnamespaceNMSP @ org @ normalNS @@ V?$ allocator @ VVeryBigDifferentName1 @ verylonglongnamespaceNMSP @ org @ normal

NS @@@ std @@ @ 6 @ AEAV?$ vector @ VlongBigDifferentName2 @ verylonglongnamespaceNMSP @ org @ normalNS @@ V?$ allocator @VVeryBigDifferentName2 @ verylonglongnam

espaceNMSP @ org @ normalNS @@@ std @@@ 6 @ AEAV?$ vector @ VVeryBigDifferentName3 @ verylonglongnamespaceNMSP @ org @ normalNS @@ V?$ allocator @VVeryBigDifferent

Name3 @ verylonglongnamespaceNMSP @ org @ normalNS @@@ std @@@ 6 @ AEAV?$ vector @ VVeryBigDifferentName4 @ verylonglongnamespaceNMSP @ org @ normalNS @@ V?$ alloca

tor @VVeryBigDifferentName4 @ verylonglongnamespaceNMSP @ org @ normalNS @@@ std @@@ 6 @ AEAVVeryBigDifferentName1 @ 234 @ AEAV?$ vector @ VClName1 @ verylonglong

namespaceNMSP @ org @ normalNS @@ V?$ allocator @ VClName1 @ verylonglongnamespa ceNMSP @ org @ normalNS @@@ std @@@)

actual_code.dll:致命错误LNK1120:1个未解析的外部因素

error LNK2001: unresolved external symbol "public: virtual void __cdecl normalNS::org::verylonglongnamespaceNMSP::bigandlo
ngClassNameGiven::ReadFlow(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::vector
<class normalNS::org::verylonglongnamespaceNMSP::VeryBigDifferentName1,class std::allocator<class normalNS::org::verylonglongnamespaceNMSP::
VeryBigDifferentName1> > &,class std::vector<class normalNS::org::verylonglongnamespaceNMSP::VeryBigDifferentName2,class std::allocator<clas
s normalNS::org::verylonglongnamespaceNMSP::VeryBigDifferentName2> > &,class std::vector<class normalNS::org::verylonglongnamespaceNMSP::Ver
yBigDifferentName3,class std::allocator<class normalNS::org::verylonglongnamespaceNMSP::VeryBigDifferentName3> > &,class std::vector<class n
ormalNS::org::verylonglongnamespaceNMSP::VeryBigDifferentName4,class std::allocator<class normalNS::org::verylonglongnamespaceNMSP::VeryBigD
ifferentName4> > &,class normalNS::org::verylonglongnamespaceNMSP::VeryBigDifferentName1 &,class ?? ::vector<class normalNS::org::verylonglo
ngnamespaceNMSP::ClName1,class std::allocator<class normalNS::org::verylonglongnamespaceNMSP::ClName1> > &, ?? ) throw( ?? )" (?ReadFlow@big
andlongClassNameGiven@verylonglongnamespaceNMSP@org@normalNS@@UEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAV?$ve
ctor@VVeryBigDifferentName1@verylonglongnamespaceNMSP@org@normalNS@@V?$allocator@VVeryBigDifferentName1@verylonglongnamespaceNMSP@org@normal
NS@@@std@@@6@AEAV?$vector@VVeryBigDifferentName2@verylonglongnamespaceNMSP@org@normalNS@@V?$allocator@VVeryBigDifferentName2@verylonglongnam
espaceNMSP@org@normalNS@@@std@@@6@AEAV?$vector@VVeryBigDifferentName3@verylonglongnamespaceNMSP@org@normalNS@@V?$allocator@VVeryBigDifferent
Name3@verylonglongnamespaceNMSP@org@normalNS@@@std@@@6@AEAV?$vector@VVeryBigDifferentName4@verylonglongnamespaceNMSP@org@normalNS@@V?$alloca
tor@VVeryBigDifferentName4@verylonglongnamespaceNMSP@org@normalNS@@@std@@@6@AEAVVeryBigDifferentName1@234@AEAV?$vector@VClName1@verylonglong
namespaceNMSP@org@normalNS@@V?$allocator@VClName1@verylonglongnamespaceNMSP@org@normalNS@@@std@@@)
actual_code.dll : fatal error LNK1120: 1 unresolved externals

如果我减少任何类的长度,那么它就会成功链接。   由于遵循的标准,我无法减少原型的长度。

If i lessen the length of any of the Class then it gets successfully linked.   I am not in a position to lessen the length of the prototype because of the standards followed.

所以请帮助解决以下问题

So please help on the following queries

原型是否有最大长度限制?

Is there any maximum length limitation for the prototypes?

有没有增加它的选项?  

Is there any option to increase it?  

推荐答案

这里已经有人问过:
https://social.msdn.microsoft.com/Forums/en-US/be2c7e47-d9f5-4bc5-a85d-5c3b1fc37ca1/length-of-function-prototype-error-lnk2001-unresolved-external-symbol-? forum = vcgeneral

很抱歉,但也没有答案。我也不知道答案。我在网上搜索但没有找到关于原型长度的答案。 

Sorry but there is no answer too. I don't know an answer too. I searched the web but didn't find an answer about the length of a prototype. 

也许你可以通过你的VS询问:帮助 - >发送反馈 - >报告问题。

Maybe you can ask through your VS: Help->Send feedback->Report a Problem.

问候,Guido


这篇关于将函数与大型原型链接时链接器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 10:55