User forums > General (but related to Code::Blocks)
Error in CB but not in VC2005
(1/1)
briahn06:
I tried to build this file:
--- Code: ---#if !defined(XMLSETTINGS_H)
#define XMLSETTINGS_H
//#import "msxml4.dll" named_guids raw_interfaces_only
/////////////////////////////////////////////////////////////////////////////
// CXMLSettings window
#include <atlbase.h>
class CXMLSettings
{
// Construction
public:
CXMLSettings()
{
XmlDocPtr = NULL;
cstrConfigFile = "";
}
// Implementation
public:
void SetSettingsFile(CString cstrFile) { cstrConfigFile = cstrFile; };
long GetSettingLong(CString cstrBaseKeyName, CString cstrValueName, long lDefaultValue);
long SetSettingLong(CString cstrBaseKeyName, CString cstrValueName, long lValue);
CString GetSettingString(CString cstrBaseKeyName, CString cstrValueName, CString cstrDefaultValue);
long SetSettingString(CString cstrBaseKeyName, CString cstrValueName, CString cstrValue);
BOOL DeleteSetting(CString cstrBaseKeyName, CString cstrValueName);
protected:
MSXML2::IXMLDOMDocument2Ptr XmlDocPtr;
CString cstrConfigFile;
CString* ParseKeys(CString cstrFullKeyPath, int &iNumKeys);
BOOL LoadXML();
BOOL SaveXML();
void UnloadXML() { XmlDocPtr = NULL; };
MSXML2::IXMLDOMNodePtr FindNode(MSXML2::IXMLDOMNodePtr parentNode, CString* pCStrKeys, int iNumKeys, BOOL bAddNodes = FALSE);
};
#endif XMLSETTINGS_H
--- End code ---
in CB with the atl libraries and such included, but I seem to get this error (among many more):
error: redeclaration of C++ built-in type 'short'
in the crtdefs.h located in the VC\includes folder.
When I build this exact same file in VC2005, it builds properly with only 1 warning and 0 errors. Any ideas?
JFalcon:
Greets,
There are a few things you need to look at. 1) Your #include paths. Some #include files take precedence over another if found first; 2) any pre-defined pre-processor macros. Some of them are always created for you by default (such as those by the friendly Code::Blocks Wizards) or those which are created for you in your other IDE; 3) any pre-processor macros that you might need to actually add to your own code to work with a particular source file.
When in doubt, check the file that complains: chances are you will still need to do a bit of 'grep' work to find the file that is causing the problem. Looking at the header file where the problem appears, does it appear around an "#if #else #endif" block? What caused that to be included?
If you go back to your VS project and examine it's pre-defined symbols, are they all defined in your Code::Blocks project too? Keep in mind there may be some (as I have seen commented out) compiler specific directives that may cause other issues.
Regards,
Joe
jarro_2783:
--- Quote ---error: redeclaration of C++ built-in type 'short'
in the crtdefs.h located in the VC\includes folder.
--- End quote ---
If you're including Visual C files it won't work.
Navigation
[0] Message Index
Go to full version