Let $X$ be a triangulated manifold of dimension $n$. Let $[W_{n-p}] \in H_{n-p}(X,\mathbb{Z}_2)$, be the homology class that's Poincaré dual to the $p$-th Stiefel-Whitney class $[w_p] \in H^p(X,\mathbb{Z}_2)$. There is a canonical chain-level formula, see Halperin-Toledo, for $W_{n-p} \in Z_{n-p}(X,\mathbb{Z}_2)$ given some barycentric subdivision of a triangulation of $X$: that,

$$W_{n-p} = \sum_{\sigma_p \subset K'} \sigma_p$$

where $K'$ is the set of all simplices in the barycentric subdivision, and $\sigma_p$ runs over the $p$-simplices of K'. So, $W_{n-p}$ is represented by the sum of the duals of all $p$-simplices in $K'$.

I seem to be misunderstanding what this formula is saying, and it doesn't make sense to me, e.g. in 2 dimensions. Let's pick an example of some manifold such that $[w_1]$ and $[w_2]$ *don't* vanish, like $\mathbb{R}P^2$. I'm seeing two issues with the above formula.

First, in any triangulation of any two manifold, the dual graph is trivalent (since every face in the original 1-skeleton is bounded by a triangle). So, taking the sum of every 1-cell in $K'$ has a nonempty boundary, since at every vertex there are three edges: the boundary would in fact be every single vertex! So, the chain supposedly representing $w_1$ isn't even a cycle.

Second, suppose that the original triangulation had $F$ faces (2-simplices). Then the barycentric subdivision would have $6 F$ faces, which is an even number. So, the sum of all the (dual) 0-cells would be a boundary, since there's an even number of them! And its (mod 2) integral would be 0. This can't represent $[w_2]$ if $[w_2] \neq 0$.

How exactly should one interpret this formula? A picture for 2D may help clarify this.

EDIT: Actually, it seems like the formulas *don't* pass to the dual lattice at all, they are used to view the chains as living on the triangulation itself. If this is the case, then the formula actually matches up for the case of a triangulation of $\mathbb{R}P^2$, that for its barycentric subdivision there's an odd number of 0-simplices and that all the 1-simplices give a dual of $w_1$