|
Using VS2005:
So there I am happily coding along, using classes that I wrote 6 years ago. The class in question has the following general content:
class CMyClass
{
public:
CMyClass(CString sFileName);
CMyClass();
virtual ~CMyClass();
...
};
I didn't feel like dealing with pointers, so I defined this:
class CMyOtherClass
{
CMyClass m_myClass;
...
};
The compiler is complaining that there's no default constructor for CMyClass, but there is (the bodies of both constructors are in the CPP file).
What am I missing?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
dont you have to put almost like a 'forward definition' for CMyClass before CMyOtherClass ?
(sorry John, I cant remember the syntax - its simple and I should be able to ...)
ok - found this - it may be what I was thinking of
http://www.codesampler.com/miscsrc.htm[^]
look for "Forward Declarations"
'g'
-- modified at 7:46 Saturday 26th August, 2006
|
|
|
|
|
I can see no problem with your code - can you post more of it?
Steve
|
|
|
|
|
John, you're getting lazy.
I did a test compile of the code you gave and it compiles fine.
I hate to say it but it looks like there is something else you forgot to post.
If CMyOtherClass didn't have a constructor (and CMyClass::CMyClass() wasn't defined) then you would get 'no default constructor for CMyOtherClass' (even though it's CMyClass w/o default constructor).
So, i assume CMyOtherClass has a defined constructor.
If CMyClass::CMyClass() didn't exist in .cpp (and CMyClass() is in header) then you'd get a link error - 'unresolved external CMyClass::CMyClass()'.
If CMyClass() not in header, but CMyClass::CMyClass() in .cpp then you'd get your error 'no default constructor for CMyClass' but you'd also get 'CMyClass::CMyClass() overloaded function not found in CMyClass'.
The only case where you _only_ get the error 'no default constructor for CMyClass' is when CMyClass() isn't in either the .h or .cpp files.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
hi Everybody,
I have been doing an application in which i have splitted the window into Two panes .By selecting the buttons in first pane,we can change the views in the second pane.Now My doubt is i have added buttons with icon's and color in both the panes of the splitter window.First as we run the application dy default some view will be there in the second pane.If we change the views of the second pane by selecting different buttons in the first pane,views will change ,but the color and icon of the buttons are being lost in the second pane.Can any body help me in this problem so that if we change the views also the Buttoon's color and icon does not loose.
Thanks in advance,
Radhika.
|
|
|
|
|
hi,
The buttons i used in my application are created by using the logic of the buttons in Buttonst aricle in vc++.
Thanks,
Radhika.
|
|
|
|
|
Hello everyone,
When using dir command to list all the files in a directory, for example, here is an output,
--------------------
C:\temp\test>dir
Volume in drive C is C
Volume Serial Number is CC95-21FF
Directory of C:\temp\test
2006-08-26 16:47 .
2006-08-26 16:47 ..
2006-08-26 16:47 0 foo.txt
2006-08-26 16:47 0 goo.txt
2 File(s) 0 bytes
2 Dir(s) 3,082,964,992 bytes free
--------------------
What I want to get are, foo and goo (files ends with .txt). I know how to do this in a programming way, parsing and parsing ...
Could anyone have any ways which does not need programming, for example, by using some Windows commands (does there are any commmad like grep or cut on Linux)?
thanks in advance,
George
|
|
|
|
|
If you want to find files from your code use CFileFind
else...install unixutils and you'll have ls and grep (and lots of other usefull things)
|
|
|
|
|
Thank you eusto!
I think using CFileFind is a programming way, right? But I am looking for a way which is simply enough without any programming efforts.
unixutils makes senses. I will study it. Thank you again!
regards,
George
|
|
|
|
|
|
|
|
Yes, I am using a utility which ports grep like UNIX commands to Windows. Seems that Windows built-in commands do not have such rich functions.
regards,
George
|
|
|
|
|
I ahve a created a client server application useing TCP.
and another application useing UDP (methods: SendTO(),ReceivedFrom()),
in both applications the data will send to teh server and server receives the data. But i havent found a much difference by changeing the protocals.
programetically what is the diff betweem UDP&TCP?
|
|
|
|
|
Hello Ramanand,
ramanand_bulusu wrote: programetically what is the diff betweem UDP&TCP?
Actually programetically not much more difference.
The difference is releted to use of bandwidth, multicasting, reliablity of data send/receive & other.
regards,
Divyang Mithaiwala
System Engineer & Software Developer
|
|
|
|
|
Divyang Mithaiwala wrote: The difference is releted to use of bandwidth, multicasting, reliablity of data send/receive & other.
i heard that UDp wont give the aknoldgements for sending the data.
does it right?
-- modified at 5:59 Saturday 26th August, 2006
|
|
|
|
|
In UDP there is no need to give ACK. so it is not reliable.
That's why udp take less bandwith for realtime transmission.
& It's easy to send multicast data via udp.
regards,
Divyang Mithaiwala
System Engineer & Software Developer
|
|
|
|
|
The biggest difference is that TCP/IP provides guaranteed delivery of messages in a specific order. UDP does not; messages can be fail to be delivered, or delivered out of order.
Software Zen: delete this;
|
|
|
|
|
UDP is a connectionless protocol which means is doesn't maintain a connection between sender and receiver. I believe with UDP packet delivery isn't guaranteed and the packets are not even guaranteed to be received in the same order sent. It consumes fewer resources however. I'm not an expert in this field however. I'd recommend doing some reading.
Steve
|
|
|
|
|
|
While running project in debug mode , I am able to add breakpoints
but as soon as I start debugging with F5 it gives one note and disable
all the breakpoints in program. What can be reason ?
|| ART OF LIVING ||
|
|
|
|
|
shivditya wrote: F5 it gives one note and disable
all the breakpoints in program. What can be reason ?
what note it is giving? Generally this happen, when file having break point is not part of exe.
|
|
|
|
|
It seems you need to see property from your project for see debug status
|
|
|
|
|
I created a ATL project with the VS2005, and in the project I used the c# component. So I selected the "Common Language Runtime Support(/clr)",
First I built the Release version, and compiled successfully.
But when I built the Debug version, I encountered a problem, the compiled failed. and prompt "Command line error D8045 :cannot compile C file 'MCChannel_i.c' with the /clr option". I tried to disable the /clr option, but there is other compiler error.
Who know the reason, please help me , thanks!
|
|
|
|
|
I have been building static link libraries lately and when I come to use them I get the following linker error:
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
I know it is safe to ignore, but is there some code I should be adding somewhere so that I don't get the error in the first place?
|
|
|
|