How can we test the c++/WinRT library using a c++ console application

Harikrishnan V R 21 Reputation points
2021-04-08T12:04:02.867+00:00

Im writing a C++/WinRT library now and I'd like to test the API in a C++ console.

Any way to do this?

Universal Windows Platform (UWP)
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,525 questions
0 comments No comments
{count} votes

Accepted answer
  1. Yan Gu - MSFT 2,676 Reputation points
    2021-04-09T03:11:33.64+00:00

    Hello,

    Welcome to Microsoft Q&A.

    It is not supported to test a C++/WinRT library(whichever the project is a C++ DLL(Universal Windows) project or a C++ Static Library(Universal Windows) project) in a C++ console application. The compiler will tell you that a reference to your library cannot be added to a console application because the two projects target different platforms.

    We suggest you use a UWP app to test your winrt library. You could refer to the document to learn how to add a reference to your c++/winrt library project from a UWP app(including Blank App(C++/WinRT) project and Core App(C++/WinRT) project).


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful