microsoft / cppwinrt

C++/WinRT
MIT License
1.67k stars 241 forks source link

Intellisense not working #55

Closed Zingam closed 7 years ago

Zingam commented 7 years ago

I just downloaded the latest XDK and tried the included headers in VS2015 Update 3 but Intellisense just doesn't work. Is this how it is supposed to be? I haven't tried with UWP as we are not at that stage yet.

kennykerr commented 7 years ago

If you try to use C++/WinRT with the /ZW compiler flag (C++/CX support) then the IntelliSense compiler struggles to keep up. Your best bet is to make sure you're building a standard C++ project without /ZW. You can also try the samples provided here on GitHub. IntelliSense should work for all of them. Let us know if that doesn't resolve this issue for you.

jonitis commented 7 years ago

This should be known problem, but IntelliSense gets confused with range for and co_await operator overload. In code like this:

auto allReadersSelector = SmartCardReader::GetDeviceSelector();
auto devices = co_await DeviceInformation::FindAllAsync(allReadersSelector);

// this range-based 'for' statement requires a suitable "begin" function and none was found
for (const auto& device : devices) {
    auto smartCardReader = co_await SmartCardReader::FromIdAsync(device.Id());
    auto cards = co_await smartCardReader.FindAllCardsAsync();

    for (const auto& card : cards) {
        // this co_await expression requires a suitable "await_ready" function and none was found
        auto infoBuffer = co_await card.GetAnswerToResetAsync();
    }
}

Both the same IntelliSense errors are present with VS 2015 Update 3 and 2017 RC, but code compiles and runs just fine.

kennykerr commented 7 years ago

Yes, I'm aware of this. IntelliSense uses a different C++ compiler, which sees the world differently. I'll make sure the IntelliSense team is aware of this. Thanks for the feedback!

Zingam commented 7 years ago

Thanx for clearing this up for me. /ZW fixes the issue at least for the UWP and XDK sample projects that I am attempting to convert but I have some issues to get them working.

Unfortunately for mixed c++/cx and c++/winrt code it's not going to be very pretty for now. And for our real game I'll postpone the conversion until after the certification.

Zingam commented 7 years ago

BTW. Even with /ZW disabled the latest VS2017 RC has some intellisense issues with C++/WinRT. Like the winrt::make<>() function. capture1

BrentRe commented 7 years ago

Known issue. We have bugs opened on the Intellisense team to address all these issues.