Hi,
does anyone have an idea, why do I get the following error
(I have to use g++296 on RedHat Linux as compiler):
In file included from r_dir.cpp:9:
r_obey.h:262: declaration of
`const AreaSet &CObeyFile::Are aSet () const'
r_areaset.h:197 : changes meaning of `AreaSet' from `class AreaSet'
The afore-mentioned line in r_obey.h is:
class CObeyFile
{
private:
AreaSet iAreaSet;
public:
const AreaSet& AreaSet() const; // line 262
And the line in r_areaset.h is:
class AreaSet
{ // line 197
public:
AreaSet();
~AreaSet();
Same code compiles fine with MS VC++.
Thank you for any hints!
Alex 3 1856
Alexander Farber wrote: Hi,
does anyone have an idea, why do I get the following error (I have to use g++296 on RedHat Linux as compiler):
In file included from r_dir.cpp:9: r_obey.h:262: declaration of `const AreaSet &CObeyFile::Are aSet () const' r_areaset.h:197 : changes meaning of `AreaSet' from `class AreaSet'
The afore-mentioned line in r_obey.h is:
class CObeyFile { private: AreaSet iAreaSet;
public: const AreaSet& AreaSet() const; // line 262
And the line in r_areaset.h is:
class AreaSet { // line 197 public: AreaSet(); ~AreaSet();
Same code compiles fine with MS VC++.
Well, in r_areaset.h, 'AreaSet' is a class. Then, in r_obey.h, you try
to redeclare it as a function. You can't do that. The easy solution
is to rename the function to something like GetAreaSet().
Kristo
Alexander Farber wrote: Hi,
does anyone have an idea, why do I get the following error (I have to use g++296 on RedHat Linux as compiler):
In file included from r_dir.cpp:9: r_obey.h:262: declaration of `const AreaSet &CObeyFile::Are aSet () const' r_areaset.h:197 : changes meaning of `AreaSet' from `class AreaSet'
The afore-mentioned line in r_obey.h is:
class CObeyFile { private: AreaSet iAreaSet;
public: const AreaSet& AreaSet() const; // line 262
Your function is called AreaSet, just the same as the class.
Hi,
Rolf Magnus wrote: Alexander Farber wrote: In file included from r_dir.cpp:9: r_obey.h:262: declaration of `const AreaSet &CObeyFile::Are aSet () const' r_areaset.h:197 : changes meaning of `AreaSet' from `class AreaSet'
The afore-mentioned line in r_obey.h is:
class CObeyFile { private: AreaSet iAreaSet;
public: const AreaSet& AreaSet() const; // line 262
Your function is called AreaSet, just the same as the class.
but it is a member function (of the class CObeyFile) isn't it?
I still don't understand, why their names clash
Regards
Alex This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Anon Email |
last post by:
Hey people,
This looks really weird. I can't make sense of it. Is this a mistake?
Can anyone help?
IStack const & GetStack () const;
Cheers,
|
by: elviin |
last post by:
Hello.
I'd like to know what means const() in the following declaration
T & operator(std::ptrdiff_t i) const() const;
I've been looking on
http://boost.org/libs/smart_ptr/shared_array.htm
|
by: kelvSYC |
last post by:
This little bit of seeminly innocent code seems to give me these two
errors, all on the line that declares check(). Is there some part of
C++ that I'm missing out on?
class Condition {
public:
Condition() {}
virtual ~Condition() {}
virtual bool check() const;
|
by: vilhelm.sjoberg |
last post by:
Hello,
I am a resonably confident C programmer, but not very sure about the
dark corners of C++. Recently, I had G++ give me a strange error.
The program in question is in essence:
struct foo {
};
|
by: hzmonte |
last post by:
typedef int t_compare_func(const void *, const void *);
struct node *tree_search(struct node *root, const void *keyy,
t_compare_func *comp)
{
struct node *cur_item;
int result;
if (root == NULL) return NULL;
cur_item = root;
while (cur_item != NULL) {
| |
by: Alex Sedow |
last post by:
Why interface-event-declaration does not support multiple declarators like
event-declaration?
Grammar from C# spec:
variable-declarators:
variable-declarator
variable-declarators "," variable-declarator
variable-declarator:
|
by: Jason Heyes |
last post by:
Are these two lines equivalent?
const int x = 3;
const x = 3;
Thanks.
|
by: Owen Ransen |
last post by:
When I installed the new VC 2005 I though, aha
at last I will be able initialise static const
members in the H file, and I can, but only
integer types. double types have to be declared
in the H file but initialied in the CPP file.
It seems that MS is following the standard this
time, but why is there that rule?
|
by: =?utf-8?b?QXNiasO4cm4gU8OmYsO4?= |
last post by:
Suppose I have a function that takes a pointer as its input, but does
not change what the pointer points to. In that case, the const
qualifier can be used to indicate that the variable pointed to is not
changed. But should this const qualifier be used in the function
declaration, the function definition, or both?
Example:
In .h-file
int foo(const int *bar);
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |