Connecting Tech Pros Worldwide Forums | Help | Site Map

Problems using omanip

David Williams
Guest
 
Posts: n/a
#1: Jul 22 '05
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

Victor Bazarov
Guest
 
Posts: n/a
#2: Jul 22 '05

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


David Williams
Guest
 
Posts: n/a
#3: Jul 22 '05

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]

Closed Thread