none
Using UWP APIs in Win32 C++ Apps RRS feed

  • Question

  • I am not sure if this is the correct forum to ask this question. I am aware that it is possible to use Universal APIs in Win32 apps using Universal API contract. I am tying to do a sample app service app based on the git.ie. a UWP app talking to Win32 c++ app  https://github.com/microsoft/DesktopBridgeToUWP-Samples/tree/master/Samples/AppServiceBridgeSample_C%2B%2B

    My question is ,it is sufficient to include the below locations in C++/General/Additional #using Directive  setting in the Win32 C++ app?

    $(SystemDrive)\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.UniversalApiContract\1.0.0.0
    $(SystemDrive)\Program Files (x86)\Windows Kits\10\UnionMetadata
    $(SystemDrive)\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcpackages
    $(SystemDrive)\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.FoundationContract\1.0.0.0

    I have all these installed in my system. Still I am getting error with the below includes/statements on the Win32 C++ side.

    #using <Windows.winmd>
    #include <iostream>
    #include <string>
    #include <ppltasks.h>
    #include <windows.h>
    #include <appmodel.h>

    using namespace concurrency;
    using namespace Platform;
    using namespace Windows::ApplicationModel::AppService;
    using namespace Windows::ApplicationModel::DataTransfer;
    using namespace Windows::Foundation;
    using namespace Windows::Foundation::Collections;

    fatal error C1190: managed targeted code requires a '/clr' option. But the Win32 C++ app in the original git sampel doesnt have clr support. How to fix this one?

    Sunday, September 22, 2019 6:14 PM

All replies

  • The moderators will likely appreciate it if you try to follow the guidelines as in Guide to posting: subject line tags.


    Sam Hobbs
    SimpleSamples.Info

    Sunday, September 22, 2019 9:14 PM
  • Hi,

    If you try to turn on /clr support, will the same problem occur? And I notice that the original git sample set the /zw option, have you also set it? If these still don't fix the issue, can you please provide a simple sample for us to test?

    Best Regards,

    Fay


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, September 23, 2019 7:28 AM