This usually happens because the default threading model (_ATL_FREE_THREADING) is not the threading model you are using in your project. The default threading model is defined in <atldef.h>, but this header is included by several other headers, such as <afxwin.h>, <afx.h>, <atlcore.h>, etc.
The threading model you are using is usually defined in the <stdafx.h> header for your project, so if you include one of the files listed above, before you include the <stdafx.h>, you could get the 'More than one global threading model defined' error.
I would suggest one of two things, either include your <stdafx.h> header before any other, unless you define your threading model elsewhere, then you must make sure you define your threading model before you include the afx or atl headers.
A second solution would be to define your threading model in your project settings as predefine. The possible threading models are:
_ATL_SINGLE_THREADED
_ATL_APARTMENT_THREADED
_ATL_FREE_THREADED
More than one global threading model defined
最新推荐文章于 2017-05-27 17:19:00 发布