XmlLite says: error C2146: syntax error : missing ‘;’ before identifier ‘IXmlReader’


This is something that I’ve been asked more than once, and so here goes an answer that might help if you run into this.


Let’s say that you create a new project and borrow code or do something of the sort, and suddenly start getting an error message such as this one


xmllite.h(49) : error C2146: syntax error : missing ‘;’ before identifier ‘IXmlReader’


This typically points to a missing macro. You can fix this by adding this to your include headers:


#include “objbase.h”


If you’re using Visual C++-style projects, this may already be included via stdafx.h including the Windows headers for you.


 

Comments (2)

  1. uabix says:

    Hi,

    I have this problem with the error c2146 in VC++.

    Although I’m tying to create a simple dll file (means that I already have stdafx.h icluded )the error keeps coming up.Actually I’m trying to create a dll file using a library created in C with header files.That means I’m trying to get a dll file using a xxxx.c file,a xxxx.h file and a yyyy.h file.

    I’ve been searching the net for days,trying to find a solution,but nothing helped me so far.

    Any help would be appreciated.

    Thx a lot.

  2. uabix, can you share the error message that you get, and the headers that are in the .c and stdafx.h files?

Skip to main content