如何访问名称空间"windows" [英] how to access namespace "windows"

查看:215
本文介绍了如何访问名称空间"windows"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

#include<iostream>
#include<string.h>
#include<Windows.h>
.
.
.
using namespace Windows::Networking::Connectivity;
.
.
.
ConnectionProfile^ internetConnectionProfile = NetworkInformation::GetInternetConnectionProfile();
.
.
.

上面是代码,但显示

error C2653: 'Windows' : is not a class or namespace name

我该怎么办?设置了公共语言运行时支持(/clr)

What do I do? Common Language Runtime Support(/clr) is set

推荐答案

我认为您想使用C ++/CX(而不是C ++/CLI).这些语言实际上是相同的(就其语法而言).但是构建它们并不相同:您可以使用/ZW编译器选项(在创建Windows Store应用程序时默认情况下处于启用状态)来启用C ++/CX.

I think you want to use C++/CX (not C++/CLI). The languages are practically identical (in terms of how their syntax looks). But building them is not the same: you enable C++/CX by using the /ZW compiler option (which is turned on by default when you create a Windows Store App).

在用户界面中,/ZW选项列为使用Windows运行时扩展"

In the UI, the /ZW option is listed as "Consume Windows Runtime Extension"

请参阅:

http://msdn.microsoft.com/en-us/magazine/dn166929.aspx

这篇关于如何访问名称空间"windows"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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