how to access namespace "windows"
Asked Answered
C

1

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

The above is the code but it is showing

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

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

Cloudburst answered 22/5, 2013 at 18:18 Comment(4)
.NET components are not the same as namespaces.Parapet
@MarkRansom: I think he is using C++/CLISyncretize
Are you running on windows8 and Vs2012 this are the min requirements if you want to use Windows::Networking::ConnectivityFatuity
I don't know how one uses Windows 8 apps components, but the MSDN page for a class in this namespace mentions: "Metadata: Windows.winmd ". There is probably something to include or reference in your project.Veedis
K
8

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).

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

See:

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

Kylynn answered 22/5, 2013 at 19:19 Comment(5)
well how do I specify that in visualstudio8. I mean the /zw compiler thing? I am running windows8 and visualstudi8.Cloudburst
@Part, Right-click on Project->Properties. Go to Configuration Properties->C/C++->General and you'll see "Consume Windows Runtime Extension". Set this to "Yes".Kylynn
there are the following fields Additional Include Directory; Resolve#using reference; Debug Information Format; Suppress Start-up Banner; Warning Level; . . . and the like ... But nothing called "Consume Windows Runtime Extension"Cloudburst
@Part, I see you said you are on Windows 8 and Visual Studio 8 (not sure what you mean by Visual Studio 8 (hopefully you don't mean Visual Studio 2005). You are required to have Visual Studio 2012 to use C++/CX.Kylynn
I meant Visual Studio 2008. Thanx for the Information anyways, got a round about way of what I was trying to do.Cloudburst

© 2022 - 2024 — McMap. All rights reserved.