|
This article[^] may help.
Regards,
Sandip.
|
|
|
|
|
Lots of thanks
|
|
|
|
|
Very interesting article; thanks for the link!
|
|
|
|
|
Hi,
I have created an SDI application and created a new class "CMyClass" that is derived from CObject. So I have included the header file "stdafx.h/afx.h " in CMyClass.h. I am trying to create an object of CMyClass in CMyDoc.h and for this purpose I have to include MyClass.h.When I do so and compile I am getting the "warning C4182: #include nesting level is 360 deep; possible infinite recursion" and "fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit".
In order to solve the problem , I have maximum tried to minimize the inclusion of header files. But couldn't.
How to solve this problem?
Thanks in advance.
Taruni
|
|
|
|
|
Taruni wrote: I am trying to create an object of CMyClass in CMyDoc.h and for this purpose I have to include MyClass.h
Possibly you're including MyClass.h in MyDoc.h and viceversa.
you may use
#pragma once
at the top of you header files to prevent multiple inclusion.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thank you Pallini.
#program once is already there in all the header files except in MyClass.h.When I tried to include, I am getting the errors
'CMyClass' : is not a class or namespace name
syntax error : identifier 'CMyClass'
syntax error : missing ';' before '}'
syntax error : missing ';' before '}'
.
.
.
.
.
fatal error C1003: error count exceeds 100; stopping compilation
Taruni
|
|
|
|
|
What is the source file the error is given for?
Have you included MyClass.h in that source file?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
In adding to the generated classes for SDI application (all the .h files however has #pragma once statements and all .cpp files have #include "stdafx.h" statements) , I am writing a serializable class(CMyclass) that is derived from CObject. In the MyClass.h file, I am including "stdafx.h" (as the header file for CObject and others) file and in the MyClass.cpp file, I am including "MyClass.h" file .
Upto this point the application compiles nicely. But whenever I include "MyClass.h" in "MyTrialDoc.h" (in order to create a global object of CMyClass) I get that the compiler limit.When I tried to include #pragma once , I got all the errors which I have mentioned in my previous post.
Taruni
|
|
|
|
|
The compiler reports the source file under compilation when the error occurs. This piece of info is important, please post it.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
"The compiler reports the source file under compilation when the error occurs" - Pallini are you speaking of "'CMyClass' : is not a class or namespace name" error?
Taruni
|
|
|
|
|
Instead of placing #include <stdafx.h> in your CMyClass.h, put is as the first line in CMyClass.cpp. That will most likely resolve the problem.
Good luck.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Thank you krmed.
I have even tried that. When I tried to include "stdafx.h" in .cpp files, I am getting the error "error C2504: 'CObject' : base class undefined". As the other alternatives I have even tried including "afx.h" and "afxwin.h" . But in vain.
Taruni
|
|
|
|
|
Taruni wrote: So I have included the header file "stdafx.h/afx.h " in CMyClass.h.
Under normal circumstances, there's no need to do this.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Was your project compiling correctly prior to creating CMyClass ? What does the stdafx.h file look like? The top of CMyClass.cpp should look like:
#include "stdafx.h"
#include "myclass.h" Do you concur?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Thank you David.
If I include those header files in .cpp file, then the compiler generates the error as it doesn't find the header file for CObject in MyClass.h file.Again if I include afx.h (which is usually indirectly included by stdafx.h in MyClass.h file in order to solve, the error "compiler limit: internal heap limit is reached " is once again generated.
Taruni
|
|
|
|
|
Taruni wrote: If I include those header files in .cpp file, then the compiler generates the error as it doesn't find the header file for CObject in MyClass.h file.
Which is why I asked what the stdafx.h file looks like.
At this point, I would create a "dummy" MFC project, and then create your new class via Insert --> New Class. In the Class Type combobox, select Generic Class. In the Derived From box, type CObject . Study the contents of the files created.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi,
I'm looking for C/C++ programmers interested in developing an opensource antivirus engine.
Done so far: basic virus detection using Aho-Corasick for string searching, clam database, recursive directory searching.
If you are interested please send me an email at: dreamlost88@yahoo.com
Thank you,
Have a nice day!
|
|
|
|
|
That's the wrong forum for such a post. I suppose a better choiche is the Article Requests and Ideas [^] one.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Why you dont make it yourself?
|
|
|
|
|
|
You have to use an external pictures hosting site for that (see for instance imageshack or flickr).
|
|
|
|
|
You may post of your picture hosted by website offering this service.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi to all.
I'm writing a small app using VS2008, I've placed an progress control on my dialog and set smooth property to true. Also in 'OnInitDialog()' set this:
m_Progress.SetRange(0,100);
m_Progress.SetPos(0);
m_Progress.SetBkColor(RGB(0,255,0));
m_Progress.SetBarColor(RGB(255,0,0));
I want to use this ctrl for showing how much space is left on something. E.g. the back color of progress ctrl is all green at beginning and as I step it I would like to show smooth and red color range.
The problem is that nothing of this is applied when I start the application, no smooth style bars they appear as default, back color is not set to green nor the bars are green.
How to achieve this?
Thanks!
P.S.
I'm on Win XP!
|
|
|
|
|
What happens if you remove the call to SetBarColor() and possibly the call to SetBkColor() ?
Does the bar run smoothly afterwards?
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Nothing happens then, still no smooth style!
Should I use some king of visual style to get smooth style. Think may read something like that a while ago, and how?
Thanks man for your time.
|
|
|
|