Connecting Tech Pros Worldwide Help | Site Map

Problems using omanip

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 22nd, 2005, 05:11 AM
David Williams
Guest
 
Posts: n/a
Default Problems using omanip

Hi,

I am having some difficulties compiling a library written by someone else,
and was hoping someone could indicate what's wrong! I have cut the code
down to what I believe to be the relevant part. If anyone can suggest how
to make the following code compile it would be greatly appriciated.

#include <iostream>
#include <iomanip>

std::ostream& ket(std::ostream& os, char* ket_val)
{
return os << " |" << ket_val << '>';
}

std::omanip<char*> ket(char* ket_val) //Error occurs here
{
return std::omanip<char*> (ket, ket_val);
}

From the compiler (g++ 3.3.1) I get:

test.cc:9: error: syntax error before `(' token

I believe the code was supposed to compile on earlier versions of the
compiler. I have made small changes such as removing '.h' from the headers
and putting 'std::' before some classes.

Thanks in advance for any help you can give,

David

  #2  
Old July 22nd, 2005, 05:11 AM
Victor Bazarov
Guest
 
Posts: n/a
Default Re: Problems using omanip

"David Williams" <esuvs@yahoo.co.uk> wrote...[color=blue]
> I am having some difficulties compiling a library written by someone else,
> and was hoping someone could indicate what's wrong! I have cut the code
> down to what I believe to be the relevant part. If anyone can suggest how
> to make the following code compile it would be greatly appriciated.
>
> #include <iostream>
> #include <iomanip>
>
> std::ostream& ket(std::ostream& os, char* ket_val)
> {
> return os << " |" << ket_val << '>';
> }
>
> std::omanip<char*> ket(char* ket_val) //Error occurs here[/color]

There is no template "omanip" in C++ standard library.
[color=blue]
> {
> return std::omanip<char*> (ket, ket_val);
> }
>
> From the compiler (g++ 3.3.1) I get:
>
> test.cc:9: error: syntax error before `(' token
>
> I believe the code was supposed to compile on earlier versions of the
> compiler. I have made small changes such as removing '.h' from the headers
> and putting 'std::' before some classes.[/color]

It doesn't make a class standard if you simply put 'std::' before it.

If you've been using some kind of library extension and want to keep
using it, please talk to GCC people. In the Standard C++ there is no
'omanip'.

Victor


  #3  
Old July 22nd, 2005, 05:11 AM
David Williams
Guest
 
Posts: n/a
Default Re: Problems using omanip

Ok, if it's not standard C++ I'd probably rather not be using it anyway.
I'll probably try to replace it with my own code to do something similar.
Thanks for your help.

David

Victor Bazarov wrote:
[color=blue]
> "David Williams" <esuvs@yahoo.co.uk> wrote...[color=green]
>> I am having some difficulties compiling a library written by someone
>> else, and was hoping someone could indicate what's wrong! I have cut the
>> code down to what I believe to be the relevant part. If anyone can
>> suggest how to make the following code compile it would be greatly
>> appriciated.
>>
>> #include <iostream>
>> #include <iomanip>
>>
>> std::ostream& ket(std::ostream& os, char* ket_val)
>> {
>> return os << " |" << ket_val << '>';
>> }
>>
>> std::omanip<char*> ket(char* ket_val) //Error occurs here[/color]
>
> There is no template "omanip" in C++ standard library.
>[color=green]
>> {
>> return std::omanip<char*> (ket, ket_val);
>> }
>>
>> From the compiler (g++ 3.3.1) I get:
>>
>> test.cc:9: error: syntax error before `(' token
>>
>> I believe the code was supposed to compile on earlier versions of the
>> compiler. I have made small changes such as removing '.h' from the
>> headers and putting 'std::' before some classes.[/color]
>
> It doesn't make a class standard if you simply put 'std::' before it.
>
> If you've been using some kind of library extension and want to keep
> using it, please talk to GCC people. In the Standard C++ there is no
> 'omanip'.
>
> Victor[/color]

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.