"I have the simplest taste. I'm always satisfied with the best" Email     Devices     Storage     Remote Workplace

Don’t use DATADIR in a VC++ project

Don’t use DATADIR in a VC++ project

So I’ve been porting the spatial augmented reality framework developed at the University of South Australia’s Wearable Compute Lab (the WCL) from Linux to Windows (VC++) and came across a weird compilation error:

…\INCLUDE\objidl.h(6624) : error C2143: syntax error : missing ‘;’ before ‘string’
…\INCLUDE\objidl.h(6624) : fatal error C1004: unexpected end of file found

This header is actually part of the VC++ headers provided by Visual Studio/Windows SDK, so it’s odd that Visual Studio was complaining about it. After a lot of Googling I came across a Spanish post about the same problem:


Basically it came down to the fact that our existing project had a “#define DATADIR”, and it just so happens this is reserved and used by the Windows headers. So all you have to do is change you DATADIR to something else, e.g. PROJECT_NAME_DATADIR and you’re set.

Best of luck 🙂