I’m having a strange issue compiling and old C++ Visual Studio 5 project in Visual Studio 2010. There is a nagging compiler error I cannot get rid of that appears to be related to the enumeration “DBTYPE”. A snippit of the .h file is given below with a few extra lines incase the error is coming from above:
struct CBrowseField;
class CODBCBrowseDlg;
typedef CArray <CBrowseField*, CBrowseField*&> FLDNAMES;
typedef CArray <CString, LPCTSTR > COLNAMES;
enum DBTYPE
{ //this bracket is where all 7 errors point to.
DB_FOXPRO26,
DB_OTHERS
};
I get 7 errors when I compile, all saying the same thing and all pointing to the same line number. The error is as follows:
Error 71 error C2371: ‘DBTYPE’ : redefinition; different basic types d:\temp\npc\print manager – 1\core\blib\odbcbrowsegrid.h 29 1 npcnt
So what the heck is going on here. I’ve checked and rechecked the syntax. It looks fine to me. I’ve word searched the entire directory to see if there is another instance of DBTYPE and there isn’t. What am I missing? If its really being redefined, why the heck doesn’t it tell me where the other definitions are?
Are you using OleDb somewhere? (or something that includes its headers) It defines a DBTYPE type (in oledb.h). That could cause a conflict.