- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- STL example compile errors
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2005 02:00 PM
06-26-2005 02:00 PM
STL example compile errors
"$ cxx stl_set2.cxx
cout << *p;
.........^
%CXX-E-NOMATOPRFUN, no operator "<<" matches these operands
operand types are: ostream_withassign << const state
at line number 62 in file GLORIA$DKA300:[PROGRAM.WILLIAMS_R]STL_SET2.CXX;1
cout << *p;
.........^
%CXX-E-NOMATOPRFUN, no operator "<<" matches these operands
operand types are: ostream_withassign << const state
at line number 72 in file GLORIA$DKA300:[PROGRAM.WILLIAMS_R]STL_SET2.CXX;1
%CXX-I-MESSAGE, 2 errors detected in the compilation of "GLORIA$DKA300:[PROGRAM.WILLIAMS_R]STL_SET2.CXX;1".
anybody got any clues? Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2005 03:10 PM
06-26-2005 03:10 PM
Re: STL example compile errors
This looks completely plausible and reasonable to me. There is no "<<" operator defined for the operand type "state". What are you expecting it to display?
You either need to define the operator, or use an expression that results in a data type for which the "<<" operator is defined.
Why did it "work" before? Maybe a bug that's been fixed? Although I can compile your program under an older version of C++, I can't link it (missing some components?). So, I can't see what output you were getting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2005 07:16 AM
06-27-2005 07:16 AM
Re: STL example compile errors
The program prints:
Alaska's capital is Juneau.
Arkansas's capital is Little Rock.
California's capital is Sacramento.
Illinois's capital is Springfield.
Missouri's capital is Jefferson City.
Nevada's capital is Carson City.
West Virginia's capital is Charleston.
Wisconsin's capital is Madison.
Looking for Wisconsin.
Found.
Wisconsin's capital is Madison.
It runs OK under Windows and on one Alpha box, but not the one I have to work with. I'm trying to figure out why that is so.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2005 09:30 AM
06-27-2005 09:30 AM
Re: STL example compile errors
Note that the error message says the operand type is "const state".
If you change the code defining the operator to:
ostream & operator<<(ostream &s, const state &o)
the NOMATOPRFUN error goes away, but you then get a complaint about get_name and get_capital. Removing those references from the operator, I can get your program to compile and run, but obviously I don't see the names.
So, it looks like this is something to do with overly zealous type checking by the compiler, distinuishing between a constant and variable?
I can't see a reason why the compiler would think that *p refers to a constant.
If that doesn't help, please log a case with your local customer support centre.
(personally I subscribe to the school of thought that C++ was a huge joke played on the programmer community by Bjarne Stroustrup)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2005 04:54 PM
07-02-2005 04:54 PM
Re: STL example compile errors
HP support's answer agreed with yours on changing "ostream &operator<<(ostream &s, state &o)" to "ostream &operator<<(ostream &s, const state &o)". Also, I need to change "string get_name() { return name; }" to "string get_name() const { return name; }" and do the same for "string get_capital()".
I've attached their response, where they explain the change in the latest version of C++ and discuss fixes and workarounds.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2005 04:59 PM
07-02-2005 04:59 PM