473,508 Members | 2,289 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IDE seems to be confused about classes

Hello, I am new to this group; if my question is OT then please
excuse me and tell me where to go.

I am using MS Visual C++ with some of its graphics libraries.

Now the compiler tells me that one of the member functions
that I am trying to use is not a member of that class.

The sad irony is that when I type the name of an object
of that class, followed by a dot, the IDE helpfully displays
a pop-up list of members - and guess what, the function
is right there!

So apparently, the IDE (the source editor, in fact) and the compiler
can't agree on the class structure.

In another class (also part of a library that came with the IDE),
one of the member functions has a different set of parameters
than the pop-up help would have me believe. I managed to guess
the right set of parameters and this part compiles OK.

Is there a typical mistake made by a programmer (i.e. yours truly)
that makes Visual behave in such incoherent ways?

Thanks in advance for any enlightment,
Leszek L.

Oct 25 '06 #1
7 2053
Leszek L. wrote:
Hello, I am new to this group; if my question is OT then please
excuse me and tell me where to go.

I am using MS Visual C++ with some of its graphics libraries.

Now the compiler tells me that one of the member functions
that I am trying to use is not a member of that class.

The sad irony is that when I type the name of an object
of that class, followed by a dot, the IDE helpfully displays
a pop-up list of members - and guess what, the function
is right there!
This doesn't mean that the function "exists" - just that your IDE thinks it does.
>
So apparently, the IDE (the source editor, in fact) and the compiler
can't agree on the class structure.
Here's an absolute rule: your compiler is right. Always.
>
In another class (also part of a library that came with the IDE),
one of the member functions has a different set of parameters
than the pop-up help would have me believe. I managed to guess
the right set of parameters and this part compiles OK.

Is there a typical mistake made by a programmer (i.e. yours truly)
that makes Visual behave in such incoherent ways?
The mistake you've made is relying on your IDE. As for what's going on with your
particular error, you haven't really given us enough (any) information: can you
post a relevant piece of code and the actual error message? (See
http://www.parashift.com/c++-faq-lit...t.html#faq-5.8 for details). If
it turns out to be an error in the library (which I doubt), you'll want to find
a more appropriate group; you might also want to try a Windows-specific or
VC-specific group, for instance comp.os.ms-windows.programmer.misc.
>
Thanks in advance for any enlightment,
Leszek L.
Tom
Oct 25 '06 #2
On a note about your error, it seems like the IDE is being confused
over function names. Are you using (fairly) original function names?

If you are not including the correct #include directories and you are
using fairly common function names then there is a chance that the IDE
is picking out the functions from the wrong file.

....although I can't be sure without seeing some code or error messsages
;)

Hope that's a place to start looking anyways...

On Oct 25, 7:53 am, Tom Smith <not_giving_out...@use.netwrote:
Leszek L. wrote:
Hello, I am new to this group; if my question is OT then please
excuse me and tell me where to go.
I am using MS Visual C++ with some of its graphics libraries.
Now the compiler tells me that one of the member functions
that I am trying to use is not a member of that class.
The sad irony is that when I type the name of an object
of that class, followed by a dot, the IDE helpfully displays
a pop-up list of members - and guess what, the function
is right there!This doesn't mean that the function "exists" - just that your IDE thinks it does.


So apparently, the IDE (the source editor, in fact) and the compiler
can't agree on the class structure.Here's an absolute rule: your compiler is right. Always.


In another class (also part of a library that came with the IDE),
one of the member functions has a different set of parameters
than the pop-up help would have me believe. I managed to guess
the right set of parameters and this part compiles OK.
Is there a typical mistake made by a programmer (i.e. yours truly)
that makes Visual behave in such incoherent ways?The mistake you've made is relying on your IDE. As for what's going on with your
particular error, you haven't really given us enough (any) information: can you
post a relevant piece of code and the actual error message? (Seehttp://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.8for details). If
it turns out to be an error in the library (which I doubt), you'll want to find
a more appropriate group; you might also want to try a Windows-specific or
VC-specific group, for instance comp.os.ms-windows.programmer.misc.
Thanks in advance for any enlightment,
Leszek L.Tom
Oct 25 '06 #3
Thank you for your quick reply.

Użytkownik "Tom Smith" <no***************@use.netnapisał w wiadomości
news:eh**********@gemini.csx.cam.ac.uk...

Here's an absolute rule: your compiler is right. Always.
I am ready to recognize its authority as only second to divine.
The problem is it only tells me that I am wrong, not what I can do
to be right.

As for what's going on with your particular error, you haven't really
given us enough (any) information: can you post a relevant piece of code
and the actual error message? (See
Here is the source file and the header. Complying with the FAQ, I'm not
cutting
out any part of the code, so it's rather lengthy, but I put a "LOOK HERE"
comment
in the offending line. My purpose in that particular fragment is simply to
read in
an image file and then run through its pixels one by one, doing different
things
depending on whether each successive pixel is white or black. And they are
all either white or black; I made the image that way - so I figured I can
just take
any of the three color components and compare it to a threshold.

The error message is:

! error C2039: 'GetRed' : is not a member of 'System::Drawing::Color'

I also tried GetR(), which the headers define as synonymous with GetRed.
The result was the same.
Thanks again - L.

< ------- lengthy source file begins, stand back! ----- >

#include "StdAfx.h"
#include ".\k3palette.h"
// #include <atlsecurity.h>
#include <atlimage.h>
// #include <gdiplusbase.h//* not included originally!
// #include <gdiplusheaders.h>
// #include <gdipluscolor.h>
// #include <gdiplusbitmap.h>

#using <mscorlib.dll>
#using <system.dll>
#using <system.drawing.dll>
// #using <system.windows.forms.dll//* these lines were commented

using namespace System;
using namespace System::IO;
using namespace System::Collections; //*
using namespace System::Resources; //*
using namespace System::Drawing;
// using namespace System::Windows::Forms; //*
void K3Log(char *);

K3Palette::K3Palette(long unsigned NCol, char PaletteType)
{ // NCol =Number of colours;
// PaletteType= (uppercase letters only)
// 'G'-greyscale,
// 'H'-rainbow of hues,
// 'F'-scan full colour space
long unsigned i,k,j,j8;

N=NCol;
MyInks=new int[NCol][3];

switch(PaletteType) {
case 'G':
for(i=0;i<NCol;i++) {
MyInks[i][0]=MyInks[i][1]=MyInks[i][2]=(int)( ((double)i)/((double)NCol)
* 255.0);
};
break;
case 'H':
{
int rg=4;
int gb=3;
int br=5;
int SumCoeff;

SumCoeff=rg+gb+br;
rg=(NCol*rg)/SumCoeff;
gb=(NCol*gb)/SumCoeff;
br=NCol-rg-gb;

for(i=0;i<NCol;i++) {
// K3Log("Playing colors");
if(i<=rg) {
MyInks[i][0]=255*(rg-i)/rg;
MyInks[i][1]=255*i/rg;
MyInks[i][2]=0;
}
else if(i<=rg+gb) {
MyInks[i][0]=0;
MyInks[i][1]=255*(rg+gb-i)/gb;
MyInks[i][2]=255*(i-rg)/gb;
if(i==rg+gb) {
MyInks[i][0]=MyInks[i][1]=128;
};
}
else {
MyInks[i][0]=255*(i-rg-gb)/br;
MyInks[i][1]=0;
MyInks[i][2]=255*(rg+gb+br-i)/br;
};
};
};
break;
// case 'F': included in default!
// break; All other values of PaletteType treated as 'F'.
default:
for(i=0;i<NCol;i++) {
k=(long unsigned)( ((double)i) / ((double)NCol) * 16777216.0 );

// avoid zeros, scatter values.

MyInks[i][0]=MyInks[i][1]=MyInks[i][2]=0;
for(j=0;j<8;j++) { // now reshuffle the bits so that neighbouring..
for(j8=0;j8<3;j8++) { //.. numbers have different colours.
MyInks[i][j8]*=2;
MyInks[i][j8]+=(k&1);
k=k/2;
};
};
};

};
}

void K3Palette::GetInk(unsigned long i, unsigned long *deliver) {

// *deliver=(i&1) ? 200 : 0;
// *(deliver+1)=(i&2) ? 200 : 0;
// *(deliver+2)=(i&4) ? 200 : 0;

i=i%N;
if(i<0) {
K3Log("Negative ink number!");
i=0;
}
else
if (i>(N-1)) {
K3Log("ESceSSive ink number!");
i=N-1;
};
*deliver=MyInks[i][0];
*(deliver+1)=MyInks[i][1];
*(deliver+2)=MyInks[i][2];
};

long unsigned K3Palette::GetN() {
return(N);
};

void K3Palette::DumpLegend(char *filnam) {
// create bitmap file with given name,
// featuring 10 rows per color.
Bitmap *MujBitmap;
long i,j,k;
Color K3Ink,K3Ink2,Paper;
COLORREF PaperCOLORREF;
K3Log("Legending!");
K3Log(filnam);

MujBitmap=new Bitmap(300,10*N);
MujBitmap->SetResolution(300.0,300.0);
MujBitmap->FromFile("C:\\K3RF\\TextLegend.jpg");

for(k=0;k<N;k++) {
K3Log("another legend color");
K3Ink=Color::FromArgb(MyInks[k][0],MyInks[k][1],MyInks[k][2]);
if(MyInks[k][0]/3+MyInks[k][1]/3+MyInks[k][2]/3<127) {
K3Ink2=Color::FromArgb(255,255,255);
} else {
K3Ink2=Color::FromArgb(0,0,0);
};
for(i=0;i<300;i++) {
for(j=10*k;j<10*k+10;j++) {
Paper=MujBitmap->GetPixel(i,j);
// PaperCOLORREF=Paper.ToCOLORREF();
if(((int)(Paper.GetRed()))>210) { // LOOK HERE

MujBitmap->SetPixel(i,j,K3Ink);
}
else {
MujBitmap->SetPixel(i,j,K3Ink2);
};
};
};
};

K3Log("Saving legend");
K3Log(filnam);
MujBitmap->Save(filnam);
K3Log("Legend saved");

};

K3Palette::~K3Palette(void)
{
}
< --- and here is my header file ".\k3palette.h" --->
#pragma once

class K3Palette
{
public:
K3Palette(long unsigned, char);
~K3Palette(void);
void GetInk(long unsigned, long unsigned*);
long unsigned GetN(void);
void DumpLegend(char *filnam);
private:
int (*MyInks)[3];
long unsigned N;
};

Oct 25 '06 #4
Użytkownik "tugboat90" <bm*****@gmail.comnapisał w wiadomości
news:11**********************@m7g2000cwm.googlegro ups.com...
On a note about your error, it seems like the IDE is being confused
over function names. Are you using (fairly) original function names?
You mean - for my own functions? Yes, I usually try to be original,
prefixing names with K3 (my personal code name from long ago)
or Muj (which is misspelled Polish for "My"), or twisting the words
in other ways. But the error concerns a library function, which I neither
beget nor baptized.
If you are not including the correct #include directories and you are
This might be the case; I have the disastrous tendency to take
the existence of library functions for granted and forget where each
of them came from, or even which libraries I am using.
using fairly common function names then there is a chance that the IDE
is picking out the functions from the wrong file.
This seems to be the case - but assuming that I am including the wrong
headers and leaving the right ones out, why does the IDE not interpret
my [erroneous] #include directives in the same way the compiler does?
They are both looking at the same source file, aren't they, no matter
how many mistakes I may (must) have made in it.

Thanks for your input.
L.

Oct 25 '06 #5

Leszek L. wrote:
Thank you for your quick reply.

Użytkownik "Tom Smith" <no***************@use.netnapisał w wiadomości
news:eh**********@gemini.csx.cam.ac.uk...

Here's an absolute rule: your compiler is right. Always.

I am ready to recognize its authority as only second to divine.
The problem is it only tells me that I am wrong, not what I can do
to be right.

As for what's going on with your particular error, you haven't really
given us enough (any) information: can you post a relevant piece of code
and the actual error message? (See

Here is the source file and the header. Complying with the FAQ, I'm not
cutting
out any part of the code, so it's rather lengthy, but I put a "LOOK HERE"
comment
in the offending line. My purpose in that particular fragment is simply to
read in
an image file and then run through its pixels one by one, doing different
things
depending on whether each successive pixel is white or black. And they are
all either white or black; I made the image that way - so I figured I can
just take
any of the three color components and compare it to a threshold.

The error message is:

! error C2039: 'GetRed' : is not a member of 'System::Drawing::Color'

I also tried GetR(), which the headers define as synonymous with GetRed.
The result was the same.
Thanks again - L.

< ------- lengthy source file begins, stand back! ----- >

#include "StdAfx.h"
#include ".\k3palette.h"
// #include <atlsecurity.h>
#include <atlimage.h>
// #include <gdiplusbase.h//* not included originally!
// #include <gdiplusheaders.h>
// #include <gdipluscolor.h>
// #include <gdiplusbitmap.h>

#using <mscorlib.dll>
#using <system.dll>
#using <system.drawing.dll>
// #using <system.windows.forms.dll//* these lines were commented

using namespace System;
using namespace System::IO;
using namespace System::Collections; //*
using namespace System::Resources; //*
using namespace System::Drawing;
// using namespace System::Windows::Forms; //*
<snipped>

the following declaration declares Paper as type Color.
Color K3Ink,K3Ink2,Paper;
and i don't see
#using namespace System::Drawing::Color;
anywhere

ignoring the if and old_time cast to integer, is GetRed() a member
function of the Color class?
if(((int)(Paper.GetRed()))>210) { // LOOK HERE
You should learn a little standard C++, you'ld find it much, much
easier to write a program like this one.

Oct 25 '06 #6
User "Salt_Peter" <pj*****@yahoo.comwrote in
news:11**********************@m7g2000cwm.googlegro ups.com...
Leszek L. wrote:
the following declaration declares Paper as type Color.
Color K3Ink,K3Ink2,Paper;

and i don't see
#using namespace System::Drawing::Color;
anywhere
OK, I'll try adding that; but I thought if the class is declared
then it comes with all its member functions? And if the class
were undeclared, why would the compiler accept the
declaration of Paper and only protest when I'm calling
a function?

[OO]PS: Just tried adding the declaration you suggest. Got this
error message:

! error C2867: 'System::Drawing::Color' : is not a namespace

and then the usual:

! error C2039: 'GetRed' : is not a member of 'System::Drawing::Color'

ignoring the if and old_time cast to integer, is GetRed() a member
function of the Color class?
Yes it is, at least according both to the IDE _and_ to the headers.
if(((int)(Paper.GetRed()))>210) { // LOOK HERE
You should learn a little standard C++, you'ld find it much, much
easier to write a program like this one.
Thanks; I'm trying to learn on the go. I had a difficult childhood
with plain C and Matlab.

Cheers,
Leszek.
Oct 26 '06 #7
A friend took a good look at this mess and found that the IDE
and the help system were referring to the class System::Drawing::Color,
while the actual thing used by the compiler was "struct Color" from
a different library.

Thanks to all who responded,
Leszek

Oct 27 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2604
by: Brian Roberts | last post by:
I'm confused about the use of hasattr/getattr, or possibly namespaces. I know how to do this: class UnderstandThis(object): def do_foo(self): pass def do_bar(self): pass def doit(self, cmd):...
45
2531
by: Edward K. Ream | last post by:
Hello all, First of all, my present state of mind re pep 318 is one of sheepish confusion. I suspect pep 318 will not affect Leo significantly, but I am most surprised that an apparently...
1
1488
by: Steve Baer | last post by:
I'm wrapping unmanaged C++ classes using the standard managed C++ approach. i.e. a __gc class that contains an internal pointer to an unmanaged class. The purpose is to generate a .NET class...
2
2041
by: Daniel | last post by:
I'm new to .Net and all of its abilities so I hope this makes sense. Basically I'm confused on when is the appropriate time to use web forms controls vs. regular HTML. For example in ASP...
14
2377
by: multiformity | last post by:
So I have been working on an opensource project for a while, and decided to really try to make it look better after focusing on the functionality most of this time. Up to now, I have simply used a...
3
1166
by: C CORDON | last post by:
I am verry confused about classes. I understand that classes can encapsulate properties, methods, events (don't know hoy to add events to a class), etc. I am confused with this: if you can...
9
2215
by: Gustaf | last post by:
I'm confused about structured error handling. The following piece of code is a simplification of a class library I'm working on. It works, and it does what I want, but I'm still not convinced that...
1
1294
by: Stephan Keil | last post by:
Hi all, I am somewhat confused by the Object.GetHashCode() documentation. What I am looking for, is a hash code, which is bound to the _identity_ of an object, not to it's _value_ (see other...
3
2151
by: redefined.horizons | last post by:
I've been reading about Python Classes, and I'm a little confused about how Python stores the state of an object. I was hoping for some help. I realize that you can't create an empty place holder...
0
7224
marktang
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,...
0
7323
Oralloy
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,...
0
7380
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
5050
isladogs
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...
0
4706
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...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1553
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
415
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.