Windows Embedded CE 6 and AFXWIN.H error C2039

This has just wasted a day of my time, and apparently nobody else on the internet has had the exact same problem, so I document it here for the good of humanity. 😉

I am migrating an application from Windows CE 5 to Windows Embedded CE 6. Just a little thing with a couple of dialogue boxes to exercise the hardware. At the client’s request, it used MFC. MFC and ATL 4.0 are no longer supported directly but most of the functionality is in the new ATL 8.0.

I included afxwin.h in my program, and added the Visual Studio 2005 directory to the include path:
(There is some primitive parsing going on here which means that the include path can’t have spaces. That should really be:
C:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\)

I attempt to compile my code and get this obscure error:
C:\PROGRA~1\MICROS~3\VC\ce\atlmfc\include\atltime.inl(140) : error C2039: '_time64' : is not a member of '`global namespace''

atlmfc.h is some nested include from afxwin.h and I am obviously not going to be editing that to make this work. What have I missed? I tried various orders of header inclusion, a few random definitions from suggestions on the ‘net, but nothing worked. Somebody suggested including atlosapice.h, but that threw up even more errors and left the C2039 as well. Searching how to fix that led me to a Google Group and a comment that changing the order of include directories removed some undefined errors.

Specifically, Paul Heil mentioned that he put some directories after .\ce\include and .\ce\atlmfc\include.

Bing! .\ce\include! I’m not using that at all!

I added it to the top of my include list and VC is now quite happy with “_time64”. I’m not sure what header files it was getting instead of those in “.\ce\include”, but they were certainly not the right ones.

Leave a Reply

Your email address will not be published. Required fields are marked *