[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
mbstate_t compile error
From: |
rod_001 |
Subject: |
mbstate_t compile error |
Date: |
Tue, 31 Jul 2007 22:00:05 -0700 |
User-agent: |
G2/1.0 |
According to what I can find in google the error has to do with
mbstate_t being deprecated from the native headers.
The issue only occurs when I compile classes which use native
functions like strlen, memcpy etc.
I have tried several suggested google solutions including :
* Adding the following to the top of my 'cpp' file in seperate steps
1> using namespace std;
2> namespace std {}
using namespace std;
3> typedef o-type mbstate_t;
4> #ifdef __GNUC__
#if __GNUC__ < 3
#include <hash_map.h>
namespace Sgi { using ::hash_map; }; // inherit globals
#else
#include <ext/hash_map>
#if __GNUC_MINOR__ == 0
namespace Sgi = std; // GCC 3.0
#else
namespace Sgi = ::__gnu_cxx; // GCC 3.1 and
later
#endif
#endif
#else // ... there are other compilers, right?
namespace Sgi = std;
#endif
Sgi::hash_map<int,int> my_map;
* Compiling the source with the following compile options --> g++ -c -
g ISSException.cpp -o ISSException.o -D_GLIBCXX_HAVE_MBSTATE_T
None of these solutions have resolved the compiling error and I am
also not sure I am implementing the solutions correctly.
The problem is occuring on an AIX 5.1.0.0 box running gcc version
4.0.0 which I do not readily have access to.
I have tried to replicate the errors on our linux box but the code
compiles succesfully with gcc v 4.0.4
I originally wrote the code using g++ v2.95 and there was no problem
porting the code to the AIX equivalent.
***** CPP code *****
#include <memory.h>
#include <iostream>
#include <string.h>
#include <stdio.h>
#include "ISSException.h"
class ISSExceptionImpl
{
public:
ISSExceptionImpl()
{
//puts( "Creating ISSExceptionIMPL" );
errorText = NULL;
locationInfo = NULL;
}
ISSExceptionImpl(const ISSExceptionImpl& src)
{
//puts( "Creating XSBExcpetionIMPL with src" );
errorText = NULL;
locationInfo = NULL;
}
~ISSExceptionImpl()
{
//puts( "Destructing ISSExceptionImpl" );
if ( errorText != NULL )
delete errorText;
if ( locationInfo != NULL )
delete locationInfo;
}
char *errorText;
char *locationInfo;
unsigned long ulErrorCode;
};
//-------------------------------------------------------------------------------
// ISSException::SetLocationInfo
//-------------------------------------------------------------------------------
void ISSException::SetLocationInfo( const char *pcszLocationInfo )
{
//fprintf( stdout, "Setting LocationInfo of %s\n",
pcszLocationInfo );
if (pImpl->locationInfo != NULL)
delete pImpl->locationInfo;
pImpl->locationInfo = new char[ strlen( pcszLocationInfo ) + 1];
memset( pImpl->locationInfo, 0x00, strlen( pcszLocationInfo ) +
1 );
memcpy( pImpl->locationInfo, pcszLocationInfo,
strlen( pcszLocationInfo ) );
//fprintf( stdout, "Location Info now = %s\n", pImpl-
>locationInfo );
}
***** Header code *****
class ISSExceptionImpl;
class ISSException
{
public:
/**
* @method ISSException::SetLocationInfo
* @proto void SetLocationInfo( const char *pcszLocationInfo );
* @group Public Member
* @description Sets the Location Text to the string passed in. As the
class can store
* more than one Location Text (up to 5), this will reset the number
of lines to 1.
* @param pcszLocationInfo A pointer to the string of information to
store.
* @return A const char pointer to the error location text
*/
void SetLocationInfo( const char *pcszLocationInfo );
ISSException& operator= ( const ISSException& );
private:
ISSExceptionImpl *pImpl;
};
***** Beginning of Compile Results *****
sapuat /home/mqappl/PostLink-Put >>g++ -c -g ISSException.cpp -o
ISSException>
/opt/freeware/lib/gcc/powerpc-ibm-aix5.1.0.0/4.0.0/include/wchar.h:
299: error: '
mbstate_t' has not been declared
/opt/freeware/lib/gcc/powerpc-ibm-aix5.1.0.0/4.0.0/include/wchar.h:
302: error: '
mbstate_t' has not been declared
/opt/freeware/lib/gcc/powerpc-ibm-aix5.1.0.0/4.0.0/include/c++/cwchar:
71: error:
'::mbstate_t' has not been declared
/opt/freeware/lib/gcc/powerpc-ibm-aix5.1.0.0/4.0.0/include/c++/cwchar:
145: error
: '::btowc' has not been declared
/opt/freeware/lib/gcc/powerpc-ibm-aix5.1.0.0/4.0.0/include/c++/cwchar:
150: error
: '::fwide' has not been declared
/opt/freeware/lib/gcc/powerpc-ibm-aix5.1.0.0/4.0.0/include/c++/cwchar:
151: error
: '::fwprintf' has not been declared
/opt/freeware/lib/gcc/powerpc-ibm-aix5.1.0.0/4.0.0/include/c++/cwchar:
152: error
: '::fwscanf' has not been declared
/opt/freeware/lib/gcc/powerpc-ibm-aix5.1.0.0/4.0.0/include/c++/cwchar:
155: error
: '::mbrlen' has not been declared
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- mbstate_t compile error,
rod_001 <=