|
you can't assume anything in terms of how the algorithm is implemented, once you do you're headed for trouble when implementation changes!
STL states this, it's not my personal view
Yours Truly, The One and Only!
|
|
|
|
|
Hi everyone,
I am getting some strange error message.
I have a class CCustomUnitList, which i have used in CMainFrame class. I have declare a pointer in the MainFrm.h as
extern CCustomUserList *p_ListUser;
and
CCustomUserList *p_ListUser; in MainFrm.cpp
Also i have defined an attribute of class CCustomUnitList
Everything works fine till here
I now want to access the pointer from another class CCustomUnitList. So i declared included MainFrm.h in the CustomUnitList.h . Now i am getting an error.
d:\source\baker\exp\sizecbar_src\demo2\mainfrm.h(83) : error C2146: syntax error : missing ';' before identifier 'm_ListUnit'
d:\source\baker\exp\sizecbar_src\demo2\mainfrm.h(83) : error C2501: 'CCustomUnitList' : missing storage-class or type specifiers
d:\source\baker\exp\sizecbar_src\demo2\mainfrm.h(83) : error C2501: 'm_ListUnit' : missing storage-class or type specifiers
CustomUserList.cpp
Strange thing is i did the same thing with another class CPackageList and things are working just as intended.
|
|
|
|
|
Did you include the header file of the class ?
|
|
|
|
|
Did you include header file to mainfrm for CCustomUserList for example :
#include "CustomUserList.h"
|
|
|
|
|
yup done that... I know it's not a silly mistake.. That's why i have posted it. The header files and all are in place. I have been tracing that half the day.. only then i have posted it
|
|
|
|
|
Maybe its not your problem but I would want to ask it you said include CustomUnitList.h on the MainFrm.h I want to know did you include MainFrm.h on the CCustomUnitList.h?
|
|
|
|
|
|
I think if you remove MainFrm.h of CCustomUnitList.h then you dont have these errors but if you used of some methods of MainFrm on the CCustomUnitList you will get some errors.
|
|
|
|
|
well it has me a bit confused
chaitannya_m wrote: I have a class CCustomUnitList, which i have used in CMainFrame class. I have declare a pointer in the MainFrm.h as
extern CCustomUserList *p_ListUser;
and
CCustomUserList *p_ListUser; in MainFrm.cpp
Also i have defined an attribute of class CCustomUnitList
you really have declared class USER not UNIT
but i'll take that as a typo
ensure that you really have the correct class header file included, right click and open source (to be double sure)
within mainfrm.h the error is due to incorrect header file included or you spelt the class name wrong.
if your 100% thats not the problem, post a snippet of the class's (just the top bit where you include the file and declare the class) and it gets more interesting
|
|
|
|
|
I prepared an SDI app that gathers some text from the user. I want it to return this text to some other app. For this, I created an overly simplified Dialog that has just one button that is supposed to invoke the former app to collect the text. I (am totally new to VC and) tried including the header file of former as follows
#include "..\TypingEditor\TypingEditor.h"
and then creating its object with 'new' like
CTypingEditorApp *te = new CTypingEditorApp();
But there are errors saying:
public: __thiscall CTypingEditorApp::CTypingEditorApp(void)" (??0CTypingEditorApp@@QAE@XZ)
What am i missing or diong wrong?
~Gaasha~
|
|
|
|
|
Naadia wrote: #include "..\TypingEditor\TypingEditor.h"
Is the path of the header file that you include correct?
you need to check if the file exists in the same folder as the file where you include it and change the #include "..\TypingEditor\TypingEditor.h" to #include "..\TypingEditor.h"
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I have checked and rechecked the include path several times and it's 100% correct. I think file inclusion in C++ is different from that in Java.
~Gaasha~
|
|
|
|
|
I'm not sure that I understood you correctly. So, you have a SDI application and you want to create another application (a simple dialog based app) that will retrieve some information from the SDI app. Correct ?
So, to do that, you created a new application (dialog based) and you include a header from the other application ?
There are several problems with that:
1) Your error is in fact a linking error: you include the header file but you need to add the source file in your project too.
2) The concept itself is wrong: you will need to include all the files from your SDI application in your dialog based application but that will result in conflicts (main declared twice, ...). What you need to do in fact, is to start the executable of the SDI app from your dialog based application and then use some interprocess communication. This can be quite difficult to do for a 'beginer'.
|
|
|
|
|
What you need to do in fact, is to start the executable of the SDI app from your dialog based application and then use some interprocess communication.
This is exactly what i wanna do. But the question is how to do that?
~Gaasha~
|
|
|
|
|
|
Do you want to send text to other applications?
|
|
|
|
|
|
Well, I think pretty much everything is said in this homework exercise : how to do it, what you need, etc.. What would be your approach ?
|
|
|
|
|
Using
Y = mX + c
you have simply to use 2 for loops to change the valeus of m and c (to draw every possible lines). Then, over that lines, you have simply to count the number of 1 into the data image.
Finally you will have a matrix (indexes are m and c ), where the value can be plotted as an image....the higher amplitude indicate the main line displayed into the image: (in the exaple c is about 1 or 2, and m is about -1)
Russell
|
|
|
|
|
|
hkwj88 wrote: can that method be applied too?
Of course you can!
Probally that way can be better than the other, look to the value range of the variables:
(m,c) case: both runs from -infinite to + infinite
(r,q) case: r run from 0 to 10 (the image in the example is not so big), ..and d from 0 to 2*pi:->
You have only to choose the step that you prefere.
Good luck;)
Russell
|
|
|
|
|
The Control has been register on the machine,when the user close,refresh or click "x" button on the embeded site,how does my control receive these messages? Thanks a lot.
Later buggers harm more.
|
|
|
|
|
The summary of my problem is this: two different views in a splitter window, one doc (SDI). I want to access the document's members from both views.
I've created an application with a CSplitterWnd in my MainFrame. I've created the two views using m_wndSplitter.CreateView(....);
That displays fine. Wonderful. I've got a variable in my doc class, int lookie. It's public. My class names are as follows:
CThingApp -> the app class
CThingDoc -> the doc class
CThingControlView -> the form view containing the controls
CThingDisplayView -> the graphical view displaying the data
CMainFrame -> frame class
CThingControlView was created with the whole project. I added CThingDisplayView.
So I changed the code in CThingApp:InitInstance() to look like this:
////////////////////////////
CSingleDocTemplate* pDocControlTemplate;
pDocControlTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CThingDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CThingControlView));
AddDocTemplate(pDocControlTemplate);
////////////////////////////
This seems to work.
Here's where my confusion sets in. I *thought* I now need to add the following code immediately beneath the above code:
////////////////////////////
CSingleDocTemplate* pDocDisplayTemplate;
pDocDisplayTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CThingDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CThingDisplayView));
AddDocTemplate(pDocDisplayTemplate);
////////////////////////////
I now believe that to be a false assumption because, upon building, the application displays a funny little window with the title new and what appears to be a list of options. There are two options with exactly the same text (which appears to be shortenings of my project name). If I select either one the application then starts.
Because this was incorrect behavior, I commented out the second document template code and tried several different ways of just *accessing* the data in CThingDoc from CThingDisplayView. Nothing's working.
I'm sure there is a simple solution to this. Something that my examples neglect to tell me or that I'm just not noticing.
|
|
|
|
|
|
Stop fiddling around with the DocumentTemplate!
You'll eventually destroy your application and need to start over!
Create the splitter with its views a s described in the other post.
Then, to access the document, you need to use
CThingDoc* pDoc = dynamic_cast<CThingDoc*>(GetDocument());
if()
{
} in your CThingDisplayView and CThingControlView.
Failure is not an option - it's built right in.{
|
|
|
|