473,385 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

a little problem i face when creating a variable..

> i have a file named CDSEncoder.cpp, and i wanted to create a member variable
of this in KNNDlg.cpp...so i wrote the following under my KNNDlg.h file

protected:
CDSEncoder m_encoder;

but there showed..
c:\Documents and Settings\MVP\Desktop\KNN\KNNDlg.h(25): error C2146: syntax
error : missing ';' before identifier 'm_encoder'

so my qns is how do i create a member variable of CDSEncoder?? Did i miss
out any steps or have i did the wrong thing?


Jul 21 '05 #1
3 1170

"Defused" <De*****@discussions.microsoft.com> wrote in message
news:61**********************************@microsof t.com...
i have a file named CDSEncoder.cpp, and i wanted to create a member variable of this in KNNDlg.cpp...so i wrote the following under my KNNDlg.h file

protected:
CDSEncoder m_encoder;

but there showed..
c:\Documents and Settings\MVP\Desktop\KNN\KNNDlg.h(25): error C2146: syntax error : missing ';' before identifier 'm_encoder'

so my qns is how do i create a member variable of CDSEncoder?? Did i miss out any steps or have i did the wrong thing?

OK, CDSEncoder is your class name, correct?
And, you wish to add a protected member variable to your class definition
using the name m_encoder?
If I'm guessing right so far, you're actually attempting to instantiate an
object of type CDSEncoder before finishing the class definition, thus the
compiler is complaining that it has not yet detected the end of the class
definition (denoted by a ; following a }).
Basically, AFAIK (and I'm confident I'll be corrected if I'm wrong) you
cannot create an object of the class being defined as a member variable of
that class.

--
Peter [MVP Visual Developer]
Jack of all trades, master of none.
Jul 21 '05 #2


"Peter van der Goes" wrote:

"Defused" <De*****@discussions.microsoft.com> wrote in message
news:61**********************************@microsof t.com...
i have a file named CDSEncoder.cpp, and i wanted to create a member variable of this in KNNDlg.cpp...so i wrote the following under my KNNDlg.h file

protected:
CDSEncoder m_encoder;

but there showed..
c:\Documents and Settings\MVP\Desktop\KNN\KNNDlg.h(25): error C2146: syntax error : missing ';' before identifier 'm_encoder'

so my qns is how do i create a member variable of CDSEncoder?? Did i miss out any steps or have i did the wrong thing?

OK, CDSEncoder is your class name, correct?
And, you wish to add a protected member variable to your class definition
using the name m_encoder?
If I'm guessing right so far, you're actually attempting to instantiate an
object of type CDSEncoder before finishing the class definition, thus the
compiler is complaining that it has not yet detected the end of the class
definition (denoted by a ; following a }).
Basically, AFAIK (and I'm confident I'll be corrected if I'm wrong) you
cannot create an object of the class being defined as a member variable of
that class.

--
Peter [MVP Visual Developer]
Jack of all trades, master of none.

CDSEncoder is a wrapper class i found in 1 of the sample program... and now i need to create an object of that in KNNDlg.cpp so as to call the functions there... so how can i do it? u mean i cant jus write CDSEncoder m_encoder; ?

Jul 21 '05 #3

"Defused" <De*****@discussions.microsoft.com> wrote in message
news:D6**********************************@microsof t.com...


"Peter van der Goes" wrote:

CDSEncoder is a wrapper class i found in 1 of the sample program... and now i need to create an object of that in KNNDlg.cpp so as to call the
functions there... so how can i do it? u mean i cant jus write CDSEncoder
m_encoder; ?


Have you included the CDSEncoder class header in your program?
The class needs to be available to your program. Is that class defined as
part of the sample program?

--
Peter [MVP Visual Developer]
Jack of all trades, master of none.
Jul 21 '05 #4

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

Similar topics

2
by: MyNameIsnt | last post by:
Can anyone tell me why, when I click on the buttons it register 2 characters on the display? if you use the right mousebutton it works ok, but the buttons dont flash?? it works fine without the...
3
by: Defused | last post by:
> i have a file named CDSEncoder.cpp, and i wanted to create a member variable > of this in KNNDlg.cpp...so i wrote the following under my KNNDlg.h file > > protected: > CDSEncoder m_encoder; >...
14
by: CMM | last post by:
Do the developers of Visual 2005 actuall use it??? There's lots of great things in VS2005 (mostly related to the outstanding work done on the CLR)... but in general the LITTLE THINGS totally drag...
12
by: CMM | last post by:
Do the developers of Visual 2005 actuall use it??? There's lots of great things in VS2005 (mostly related to the outstanding work done on the CLR)... but in general the LITTLE THINGS totally drag...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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
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...
0
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
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...

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.