The set of affinely flat structures has been studied by many authors. Among them, we can quote William Goldman who has studied the deformations of $(X,G)$-structures. Let $X$ be a manifold, $G$ a Lie group which acts on $X$, we suppose that if two elements of $G$ coincide on an open subset of $X$, they coincide on $X$. A manifold $M$ is an $(X,G)$-manifold if it is endowed with an atlas $(U_i,\phi_i)$, where $\phi_i\colon U_i\subset M\rightarrow X$ is a diffeomorphism between $U_i$ and its image. We suppose that $\phi\circ {\phi_j}^{-1}$ is the restriction of an element of $G$.
A flat torsionless connection defined on the $n$-dimensional manifold $M$ defines on it a $(\mathbb{R}^n,\operatorname{Aff}(\mathbb{R}^n))$-structure.

The $(X,G)$-structure of $M$ can be lifted to its universal cover $\tilde M$, and there exists a developing map: $D\colon\tilde M\rightarrow X$ such that for every element $\gamma\in\pi_1(M), D\circ \gamma =h(\gamma)\circ D$. We thus have a representation $h\colon\pi_1(M)\rightarrow G$ called the holonomy representation of the $(X,G)$-structure on $M$. It is a result of Thurston that if $M$ is closed the set of holonomy of $(X,G)$-structures defined on $M$ is an open subset of $\operatorname{Rep}(\pi_1(M),G)$, the set of representations $h:\pi_1(M)\rightarrow G$.

Goldman, William M. "Varieties of representations." Geometry of Group Representations: Proceedings of the AMS-IMS-SIAM Joint Summer Research Conference Held July 5-11, 1987 with Support from the National Science Foundation. Vol. 74. American Mathematical Soc., 1988.

Available here:

http://www-users.math.umd.edu/~wmg/geost.pdf

For the dimension 2, a theorem of Benzecri shows that an oriented surface is endowed with an affine structure if and only if its genus is one.

edout" $\endgroup$ – YCor Mar 1 '16 at 11:27