'C++/WinRT console application using c++17 language projection
I was curious about how I can call .net libraries from a C++ console application using the newer C++/WinRT using C++17 language projections. But I find that it’s hard to find even a hello world example of this.
How would I create an equivalent console application in C++/WinRT as this simple C# hello world program:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DemoApplication
{
class Program
{
static void Main(string[] args)
{
Console.Write("Hello World");
Console.ReadKey();
}
}
}
Solution 1:[1]
I guess you need to use c++/cx instead of c++/WinRT, since c++/cx let’s you access .net and c++/WinRT only lets you access the UWP version of .net called runtime components:
#using <mscorlib.dll>
using namespace System;
int main(array<System::String ^> ^args)
{
System::Console::WriteLine("Hello world");
return 0;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
