Operating System - Linux
1827630 Members
3524 Online
109966 Solutions
New Discussion

this declaration may not have extern "C" linkage while porting C++ code from sunos to HP

 
Sanjesh
New Member

this declaration may not have extern "C" linkage while porting C++ code from sunos to HP

Hi,

Im porting a source code base from sunos to HP-UX. While compiling
some sources, Im getting the errors like


/opt/aCC/include/rw/xphasht.h", line 161: error #2800: this
declaration may not have extern "C" linkage
template class RWTExport RWTPtrHashTableIterator;


"/opt/aCC/include/rw/xphasht.h", line 173: error #2800: this
declaration may not have extern "C" linkage
template class RWTExport RWTPtrHashTable


/opt/aCC/include/rw/xpslist.cc", line 416: error #2800: this
declaration may not have extern "C" linkage
template RWTPtrSlink*


Is there some changes required while using roguewave libraries on HP?
The compile command is
aCC -w -Aa -AP -library=std,rwtools7,stream,Csup +p +Z -DUNIX -DSYSV -
D_XOPEN_SOURCE
-D_POSIX_SOURCE -D_HPUX_SOURCE -DRW_NO_STL -DINF_UNIX_SRC -DINF_N_MENU
-D__EXTERN_C__
-DAR_CPLUSPLUS -D__COMP_FILE__=


Please help.


1 REPLY 1
Dennis Handly
Acclaimed Contributor

Re: this declaration may not have extern "C" linkage while porting C++ code from sunos to HP

It helps if you mention your OS, 11.23? And your compiler version, aCC6?

Your problem may be due to the fact that is never a good idea to use this coding pattern:
extern "C" {
#include some file that includes unknown others
}
The proper form is:
extern "C" {
...
}
#include ...
extern "C" {
...
}

All of the aC++ headers and most system headers are already C++ified and adding an extern "C" block will just mess up overloading.

>Is there some changes required while using roguewave libraries on HP?

You're using tools.h++?

>The compile command is: aCC -w -Aa -AP

For IPF, the default is almost -AA. You shouldn't be using the -AP libs and should use -AA explicitly. Which may require a port to -AA if you ever plan to use third party shlibs.

>-library=std,rwtools7,stream,Csup

This is the wrong format for -l and you should let the compiler add the default aC++ runtime shlibs.
You may have to add -lrwtools7? Is this your shlib?

>-DRW_NO_STL

This is NOT supported with HP's version of tools.h++.