Getting errors when compiling the cxx file in solaris 9 compiler
807559 Mar 31, 2010 9:29 AMHi All
when I am compiling the cxx file on the system with compiler version (CC: Sun C++ 5.9 SunOS_sparc 2007/05/03) , I am facing the following error:-
/opt/SUNWspro/bin/CC -dy -misalign -xcode=abs64 -xarch=v9 -D__EXTENSIONS__ -Dsun4_R5=1 -I. -Isun4_R5_v -I/home/as185259/ash_iadraid/ash_get_10/IA/PORT/include -I/home/as185259/ash_iadraid/ash_get_10/IA/WV/WV5.3.6-ncr0302/build/include/sun4_R5_v -I/app/oracle/product/10.2.0/client_1/sqllib/public -I/app/oracle/product/10.2.0/client_1/precomp/public -I/opt/informix/include -DSVR4 -O -g +p -pta -c MContext.cxx -o sun4_R5_v/MContext.o || \
"/home/as185259/ash_iadraid/ash_get_10/IA/WV/WV5.3.6-ncr0302/build/include/sun4_R5_v/ssmalloc.h", line 97: Error: Only one of a set of overloaded functions can be extern "C".
"/home/as185259/ash_iadraid/ash_get_10/IA/WV/WV5.3.6-ncr0302/build/include/sun4_R5_v/ssmalloc.h", line 99: Error: Only one of a set of overloaded functions can be extern "C".
"/home/as185259/ash_iadraid/ash_get_10/IA/WV/WV5.3.6-ncr0302/build/include/sun4_R5_v/ssmalloc.h", line 101: Error: Only one of a set of overloaded functions can be extern "C".
"/home/as185259/ash_iadraid/ash_get_10/IA/WV/WV5.3.6-ncr0302/build/include/sun4_R5_v/ssmalloc.h", line 102: Error: Only one of a set of overloaded functions can be extern "C".
4 Error(s) detected.
The same file with the same compilation command is getting compiled with compiler version CC: Sun WorkShop 6 update 2 C++ 5.3 2001/05/15 .
Can anyone suggest what should be the resolution:-
The code for the ssmalloc.h file is as under:-
#ifndef SSMALLOCH
#define SSMALLOCH
#include <stddef.h>
#if defined(__sparcv9)
namespace ssmalloc {
#endif
#if defined(__cplusplus)
extern "C" {
#endif
/*
* The type for the malloc routine depends on
* the compiler and library that you are using.
*/
#if defined(hpux) || defined(sun4_R5) || defined(__GNUC__) || defined(__OS2__)
typedef void *MALLOC_PTR;
#else
typedef char *MALLOC_PTR;
#endif
#if defined(__GNUG__)
typedef size_t MALLOC_SIZE;
#else
typedef unsigned MALLOC_SIZE;
#endif
#if defined(sun4) && ! defined(__GNUG__)
# define FREE_RETURNS int
# define FREE_RETURN return 0
#else
# define FREE_RETURNS void
# define FREE_RETURN return
#endif
//
//
// User-callable routines.
//
//
// Note: memalign and valloc are broken in that they do not aling
// memory on documented boundaries, and thus do not behave as described
// on the "malloc" manual page. They simply call malloc.
//
//
MALLOC_PTR malloc (MALLOC_SIZE size);
FREE_RETURNS free (MALLOC_PTR data);
MALLOC_PTR realloc (MALLOC_PTR data, MALLOC_SIZE size);
MALLOC_PTR calloc (size_t nelem, size_t elsz);
MALLOC_PTR valloc (unsigned size);
MALLOC_PTR memalign (unsigned alignment, unsigned size);
//
// This memory allocator supports memory allocation inside signal
// handlers. For correct operation, the following functions must be
// called upon entering and exiting signal handlers that allocate
// memory.
//
void ssmalloc_enter_signal_level();
void ssmalloc_exit_signal_level();
//
// Set this variable to not 0 (possibly in the debugger) if you want
// to get malloc to check memory data structures very carefully as it
// goes. This may be handy if you are trying to detect a memory
// trasher.
//
// It also causes ssmalloc to abort the program instead of returning
// zero if memory runs out.
//
extern int check_memory_very_carefully;
#if defined(__cplusplus)
}
#endif
#if defined(__sparcv9)
} // namespace ssmalloc {
#endif
#endif /* SSMALLOCH */
when I am compiling the cxx file on the system with compiler version (CC: Sun C++ 5.9 SunOS_sparc 2007/05/03) , I am facing the following error:-
/opt/SUNWspro/bin/CC -dy -misalign -xcode=abs64 -xarch=v9 -D__EXTENSIONS__ -Dsun4_R5=1 -I. -Isun4_R5_v -I/home/as185259/ash_iadraid/ash_get_10/IA/PORT/include -I/home/as185259/ash_iadraid/ash_get_10/IA/WV/WV5.3.6-ncr0302/build/include/sun4_R5_v -I/app/oracle/product/10.2.0/client_1/sqllib/public -I/app/oracle/product/10.2.0/client_1/precomp/public -I/opt/informix/include -DSVR4 -O -g +p -pta -c MContext.cxx -o sun4_R5_v/MContext.o || \
(rm -f sun4_R5_v.d; false)CC: Warning: -xarch=v9 is deprecated, use -m64 to create 64-bit programs
"/home/as185259/ash_iadraid/ash_get_10/IA/WV/WV5.3.6-ncr0302/build/include/sun4_R5_v/ssmalloc.h", line 97: Error: Only one of a set of overloaded functions can be extern "C".
"/home/as185259/ash_iadraid/ash_get_10/IA/WV/WV5.3.6-ncr0302/build/include/sun4_R5_v/ssmalloc.h", line 99: Error: Only one of a set of overloaded functions can be extern "C".
"/home/as185259/ash_iadraid/ash_get_10/IA/WV/WV5.3.6-ncr0302/build/include/sun4_R5_v/ssmalloc.h", line 101: Error: Only one of a set of overloaded functions can be extern "C".
"/home/as185259/ash_iadraid/ash_get_10/IA/WV/WV5.3.6-ncr0302/build/include/sun4_R5_v/ssmalloc.h", line 102: Error: Only one of a set of overloaded functions can be extern "C".
4 Error(s) detected.
The same file with the same compilation command is getting compiled with compiler version CC: Sun WorkShop 6 update 2 C++ 5.3 2001/05/15 .
Can anyone suggest what should be the resolution:-
The code for the ssmalloc.h file is as under:-
#ifndef SSMALLOCH
#define SSMALLOCH
#include <stddef.h>
#if defined(__sparcv9)
namespace ssmalloc {
#endif
#if defined(__cplusplus)
extern "C" {
#endif
/*
* The type for the malloc routine depends on
* the compiler and library that you are using.
*/
#if defined(hpux) || defined(sun4_R5) || defined(__GNUC__) || defined(__OS2__)
typedef void *MALLOC_PTR;
#else
typedef char *MALLOC_PTR;
#endif
#if defined(__GNUG__)
typedef size_t MALLOC_SIZE;
#else
typedef unsigned MALLOC_SIZE;
#endif
#if defined(sun4) && ! defined(__GNUG__)
# define FREE_RETURNS int
# define FREE_RETURN return 0
#else
# define FREE_RETURNS void
# define FREE_RETURN return
#endif
//
//
// User-callable routines.
//
//
// Note: memalign and valloc are broken in that they do not aling
// memory on documented boundaries, and thus do not behave as described
// on the "malloc" manual page. They simply call malloc.
//
//
MALLOC_PTR malloc (MALLOC_SIZE size);
FREE_RETURNS free (MALLOC_PTR data);
MALLOC_PTR realloc (MALLOC_PTR data, MALLOC_SIZE size);
MALLOC_PTR calloc (size_t nelem, size_t elsz);
MALLOC_PTR valloc (unsigned size);
MALLOC_PTR memalign (unsigned alignment, unsigned size);
//
// This memory allocator supports memory allocation inside signal
// handlers. For correct operation, the following functions must be
// called upon entering and exiting signal handlers that allocate
// memory.
//
void ssmalloc_enter_signal_level();
void ssmalloc_exit_signal_level();
//
// Set this variable to not 0 (possibly in the debugger) if you want
// to get malloc to check memory data structures very carefully as it
// goes. This may be handy if you are trying to detect a memory
// trasher.
//
// It also causes ssmalloc to abort the program instead of returning
// zero if memory runs out.
//
extern int check_memory_very_carefully;
#if defined(__cplusplus)
}
#endif
#if defined(__sparcv9)
} // namespace ssmalloc {
#endif
#endif /* SSMALLOCH */