Skip to content

Windows scaffold: include Windows.Foundation.Collections in pch.h - #100

Open
turinglambdaai wants to merge 1 commit into
mainfrom
scaffold-pch-collections
Open

turinglambdaai wants to merge 1 commit into
mainfrom
scaffold-pch-collections

Conversation

@turinglambdaai

Copy link
Copy Markdown
Owner

Problem

Any scaffolded Windows app that touches an IVector/IIterable — building card lists with Children().Append, range-for over JsonArray.GetArray(), anything that calls .begin() on a projected collection — fails with dozens of

error C3779: 'winrt::impl::consume_...::begin': a function that returns 'auto' cannot be used before it is defined

because the consume templates are declared by the Control/other headers but defined in winrt/Windows.Foundation.Collections.h, which the scaffold's pch.h did not include. The error text points nowhere near the missing include.

Fix

One line in the scaffold pch.h.

Verification

Building a production app on this scaffold (payback, turinglambdaai/payback): 76 errors of exactly that shape before the include, zero after — the rest of that diff was app code.

Any scaffolded app that touches an IVector/IIterable — ListView-style
children, range-for over JSON arrays, anything with
Children().Append or .begin() — fails with dozens of C3779 'a function
that returns auto cannot be used before it is defined' errors, because
the consume templates are declared by other headers but defined in
winrt/Windows.Foundation.Collections.h, which pch.h did not include.

Hit building a production app on this scaffold (payback); the include
is cheap for apps that do not need it and saves a very confusing
riddle for every app that does.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant