0

With C++/WinRT Microsoft apparently made quite the effort to make their APIs standard-conformant. And finally they've also released a machine learning API along with a code sample repo.

Unfortunately, all samples are dependent on Visual Studio. Even the simplest command line demo (CustomTensorization) requires .snl files and VisualStudio.

Is it possible to write code for this API without VisualStudio by just downloading an SDK and using a regular make file?

If so, how? Please post or point to a MCVE.

Thank you.

Hendrik
  • 5,085
  • 24
  • 56

1 Answers1

1

I don't know anything about the machine learning API, but C++/WinRT is a header-only library that you can include and build from a developer command prompt quite easily. Here's a simple example:

C:\ml>type sample.cpp
#pragma comment(lib, "windowsapp")
#include <winrt/Windows.AI.MachineLearning.h>
#include <stdio.h>

using namespace winrt;
using namespace Windows::AI::MachineLearning;

int main()
{
    init_apartment();
    puts("Sample");
}

C:\ml>cl /EHsc /std:c++17 /nologo sample.cpp
sample.cpp

C:\ml>sample.exe
Sample

For an actual example using the machine learning API I'd suggest you start here:

https://learn.microsoft.com/en-us/windows/ai/get-started-desktop

But again, you can follow along and substitute Visual Studio with the command line and use cmake, or any other build system, if so desired.

Kenny Kerr
  • 3,015
  • 15
  • 18