Compiling programs with base classes from the C++ Standard Library using the IBM object model -qobjmodel=ibm option using XL C/C++ compiler on AIX and z/OS produces "1540-2200" error.
Compiling the following example with the -qobjmodel=ibm option on AIX and z/OS will result in an error message indicating that the base classes have different object models.
public std::unary_function<int, bool>,
Use the following command to compile the example:
xlC t.cpp -qobjmodel=ibm -c
The following error message is generated by the compiler:
"t.cpp", line 5.8: 1540-2200 (S) Class "trivial_converter_impl" has base classes with different object models.
There is a limitation of using -qobjmodel=ibm with base classes from the C++ Standard Library.
All classes in the same inheritance hierarchy must have the same object model.
There are two object models available in the XL C++ compiler on AIX and z/OS:
- IBM object model, which can be specified by the -qobjmodel=ibm option or the #pragma object_model(ibm) pragma
- The classic object model, which can be specified by the -qobjmodel=classic option or the #pragma object_model(classic) pragma
The "1540-2200" error arises because:
- The std::unary_function base class has the classic object model since the C++ Standard Library from the XL C/C++ compiler headers on AIX and z/OS specifies #pragma object_model(classic) in the source code header.
- The dummy_range_checker base class has the ibm object model since the -qobjmodel=ibm option was used on the command line.
Thus the trivial_converter_impl derived class has conflicting object models.
Resolving the problem
The -qobjmodel=ibm option cannot be used to compile program source with base classes from the C++ Standard Library on AIX and z/OS.
You can use -qobjmodel=classic which is the default.
|Software Development||z/OS XL C/C++||Compiler||z/OS||All Versions||Not Applicable|
Rate this page:
Copyright and trademark information
IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.