[UWP] VS 2015中未解决的外部变量错误(错误2001) [英] [UWP] Unresolved external variable Error (Error 2001) in VS 2015

查看:105
本文介绍了[UWP] VS 2015中未解决的外部变量错误(错误2001)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


在VS 2015中,开发一个我们有解决方案的UWP应用程序。它有11-12个子模块(C#,C ++)。 


一个是BorderLibrary,它是一个配置为dll的C ++模块。它有一个文件夹,其中几乎没有.h& .cpp文件。 


第二个子模块是C ++模块,其中我在参考中包含了BordersLibrary。它也配置为DLL。我正在使用borderLibrary中定义的cpp文件中的一个函数。 


更多数据:


1。此方法直接在命名空间(没有任何类)下声明/定义。 





但它是给出"未解决的外部符号....<然后我在本文中使用的函数....>"


我在网上尝试了很多方法但是仍然存在错误。 



任何输入?任何帮助将不胜感激。 



谢谢。

解决方案

您好,


根据我的经验,请确保本地变量(在您的文件或函数中)的名称不同,并确保其类型.cpp中的函数与其extern声明的类型匹配。另外请检查你是否在.h中添加了extern关键字


StackOverflow上有一个讨论这个常见错误的帖子,你也可以看看这里:什么是undefined
引用/未解决的外部符号错误以及如何解决?


祝你好运,


Roy


Hi,

In VS 2015, developing one UWP application in which we have a solution. It has 11-12 sub-modules (C#, C++). 

One is BorderLibrary which is a C++ module configured as dll. It has a folder in which it has few .h & .cpp files. 

Second sub-module is C++ module in which I have included BordersLibrary in reference. It is also configured as dll. I am using one function from cpp files defined in bordersLibrary. 

More data:

1. This method is declared/defined directly under namespace (without any class). 


But it is giving "Unresolved external symbol....<then my function which I am using in this text....>"

I have tried many many ways on web but still error persists. 

Any inputs? Any help will be appreciated. 

Thanks.

解决方案

Hi,

Based on my experience, please to make sure a local variable (in your file or function) has not the same name and make sure the type of the function in the .cpp matches the type of its extern declaration. Also please check if you have added the extern keyword in the .h.

There is a thread on StackOverflow that talks about this common error, you could also take a look here:What is an undefined reference/unresolved external symbol error and how do I fix it?

Best regards,

Roy


这篇关于[UWP] VS 2015中未解决的外部变量错误(错误2001)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆