构建引用PCL的C ++ / CLI库时发出警告C4691 [英] Warning C4691 when building a C++/CLI library referencing a PCL

查看:305
本文介绍了构建引用PCL的C ++ / CLI库时发出警告C4691的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Windows 8商店应用程序中构建的某些类中构建了一个PCL,并且我正在尝试在C ++ / CLI库中使用它,因此我可以使用一些旧的C ++代码来提供一些其他函数。

不幸的是,当我构建时,我收到类似这样的警告:
$
警告C4691:'System :: Object':引用的类型在未引用的程序集中是预期的' System.Runtime',在当前翻译单元中定义的类型而不是用于
警告C4691:'System :: Threading :: Tasks :: Task':在未引用的程序集'System.Threading.Tasks中预期引用的类型',用当前翻译单位定义的类型

嗅到一只老鼠,我决定建一个类库(不可移植)来引用我的C ++ / CLI实现,警告消失了。

PCL版本中的警告是否可以忽略?


顺便说一下,我使用完全相同的源文件构建。  版本之间无变化。  我刚刚将链接删除到新项目文件中。




Anthony Wieser |维瑟软件有限公司|
www.wieser-software.com

解决方案

嗨Anthony,


我们知道Windows Store App中的C ++ / CX使用不同的Type系统作为C ++ / CLI,  ;有关详细信息,请参阅此处:  键入
系统
,例如
Platform :: Object Class
 而不是System :: Object。


但是,如果我们想在Windows应用商店应用中使用现有的类库,我们可以启用

/ ZW(Windows运行时编译)
设置在我们现有项目中,请参阅我的屏幕截图:



- 詹姆斯


I've built a PCL out of some classes that I built into a Windows 8 Store app, and am trying to use it in a C++/CLI library so I can interface with some old C++ code that provides some other functions.
Unfortunately, I'm getting warnings like these when I build:
warning C4691: 'System::Object' : type referenced was expected in unreferenced assembly 'System.Runtime', type defined in current translation unit used instead
warning C4691: 'System::Threading::Tasks::Task' : type referenced was expected in unreferenced assembly 'System.Threading.Tasks', type defined in current translation unit used instead
Smelling a rat, I decided to build a Class Library (not portable) to reference in my C++/CLI implementation, and the warnings are gone.
Are the warnings in the PCL version ignorable?

I built with exactly the same source files by the way.  No changes between versions.  I just dropped links onto the new project file.


Anthony Wieser | Wieser Software Ltd | www.wieser-software.com

解决方案

Hi Anthony,

As we know C++/CX in Windows Store App use different Type system as C++/CLI, see this for more information: Type System,  for example the Platform::Object Class is instead of System::Object.

However if we want to use existing class library in Windows Store App, we can enable /ZW (Windows Runtime Compilation) setting in our existing project, see my screenshot:

--James


这篇关于构建引用PCL的C ++ / CLI库时发出警告C4691的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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