|
-
August 25th, 2010, 07:16 PM
#1
expected constructor, destructor...
Greetings.
I'm getting the following error while using Netbeans 6.9.1 on C++ code.
../GNU_iomanip.h:27: error: expected constructor, destructor, or type conversion before '&' token
../GNU_iomanip.h:27: error: expected `,' or `;' before '&' token
This is the code:
//------------------------------------------------------------------------------
//
// GNU_iomanip.h
//
// Purpose:
//
// Temporaray implementation of ostream manipulators from the
// C++ Standard Library, which are not contained in <iomanip>
// as provided with GNU C++.
//
// Notes:
//
// This software is protected by national and international copyright.
// Any unauthorized use, reproduction or modificaton is unlawful and
// will be prosecuted. Commercial and non-private application of the
// software in any form is strictly prohibited unless otherwise granted
// by the authors.
//
// (c) 1999 Oliver Montenbruck, Thomas Pfleger
//
//------------------------------------------------------------------------------
#include <iomanip>
#include <iostream>
namespace{
ostream& left(ostream& os)
{
os.setf(ios::left ,ios::adjustfield);
return os;
};
ostream& right(ostream& os){os.setf(ios::right,ios::adjustfield); return os;};
ostream& fixed(ostream& os){os.setf(ios::fixed,ios::floatfield); return os;};
ostream& showpos (ostream& os){os.setf(ios::showpos); return os;};
ostream& noshowpos(ostream& os){os.unsetf(ios::showpos); return os;};
}
I don't know what it is trying to tell me.
Any help?
Thanks.
Webbiz
-
August 25th, 2010, 08:06 PM
#2
Re: expected constructor, destructor...
All the objects etc. are located in namespace std. Example:
Code:
std::ostream& left(std::ostream& os)
{
os.setf(std::ios::left ,std::ios::adjustfield);
return os;
};
The date on that code is 1999 ... Are you sure g++ still does not have them ?
-
August 26th, 2010, 06:56 PM
#3
Re: expected constructor, destructor...
I'm not sure how to answer your question.
All I know is that unless I add the std:: that you just showed me, it will give me those errors.
You seem to know what this issue is. I'm a newbie, so I'm a bit confused at this point.
BTW, this is on a Windows 7 system and not Linux. Using Cygwin with Netbeans.
Is there a setup parameter or something that I'm missing?
Thanks.
-
August 26th, 2010, 07:14 PM
#4
Re: expected constructor, destructor...
 Originally Posted by webbiz
I'm not sure how to answer your question.
All I know is that unless I add the std:: that you just showed me, it will give me those errors.
You seem to know what this issue is. I'm a newbie, so I'm a bit confused at this point.
BTW, this is on a Windows 7 system and not Linux. Using Cygwin with Netbeans.
What version of gcc is being used (gcc is the actual compiler being used, not Netbeans, which is an IDE).
Second, that code dates back to 1999. This means there is a good chance that this code no longer is valid ANSI C++ code. That's why it's necessary to add std::, since those stream classes are in the std:: namespace.
Regards,
Paul McKenzie
-
August 27th, 2010, 12:01 AM
#5
Re: expected constructor, destructor...
This is a new installation. I downloaded the latest cygwin. Not sure how to tell what the version of gcc is. Looking at the properties doesn't seem to help.
Isn't the ANSI C++ standard dated 1998?

Webbiz
-
August 27th, 2010, 11:45 AM
#6
Re: expected constructor, destructor...
 Originally Posted by webbiz
This is a new installation. I downloaded the latest cygwin. Not sure how to tell what the version of gcc is. Looking at the properties doesn't seem to help.
Go to the command line and start the compiler (gcc.exe). I don't know the exact command-line to give you the version, but it is available.
Isn't the ANSI C++ standard dated 1998?
Yes, but many compilers still did not adhere to the standard fully at that point. I could understand if the year were 2000 or later, but 1999 puts it too close to 1998.
Regards,
Paul McKenzie
-
August 27th, 2010, 11:49 AM
#7
Re: expected constructor, destructor...
-
August 28th, 2010, 09:13 PM
#8
Re: expected constructor, destructor...
Unfortunately running gcc -v only gives me an error.
The NTVDM CPU has encountered an illegal instruction.
This is Windows 7. I had to give myself permission just to run it to this point. Yet, Netbeans doesn't seem to have any problem using it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|