|
|
I am very new at C++ programming and know little about it but I have been having complications with my errors stating that I have a undeclared identifier and I have no idea on how to correct this problem for a class assignment. Any information would be helpful.
Confused and lost
|
|
|
|
|
Posting code is a step in the right direction. I think you've mistyped a variable name and so it can't find the variable you're trying to use. For example
int nMyInt = 0;
int nMyOtherInt = nMyInnt * 2;
would generate this error, I believe.
But it's hard to tell without seeing the code and the error message.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
|
|
|
|
|
Hey coders... I am interested in building a MFC class Library but when I run it asks me:
Please specify the name of the executable to be used for the debug session.
It then offers a drop down. Listing Internet Explorer, Regsvr32.
I choose Regsvr32 because I believe that is the appropriate exe and click ok.
It then gives me a dialog warning saying no .dll was specified.
So I tried going C:\WINDOWS\System32\regsvr32.exe /i then the path of my solution but it still doesn't work.
I am also getting these errors in my output window.
LNK : warning LNK4089: all references to 'OLEAUT32.dll' discarded by /OPT:REF
LNK : warning LNK4089: all references to 'USER32.dll' discarded by /OPT:REF
If anyone could explain to me what I need to do or tell me where I could find a page that explains how to do this it would be greatly appreciated.
Thanks.
|
|
|
|
|
you can't "run" a library. a library isn't a program; it's just a collection of functions/classes.
it's prompting you for something to run.
if you want to test the functions in your library, write a program that uses those functions/classes and run it.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
Hi,
If I create a dabase table in MS Access 2000, there is a single row with 2 cells:
1) Date (today) 2) Time (present time)
By using Date/Time value and activate Tool Adavance option & Refresh every 1 second (or some thing else) ... will it update these values?
If not, can some one help me to show how to update it (automatically) after trigger it?
I did try but if fail to updated itself!
Thanks,
ATC
|
|
|
|
|
Hi everyone been trying some weird stuff lately, I'm pretty new in the VC++ world....
What I want is to pass the structure name to the function?
This is what my actual code looks like (obviously it doesn't work, yet!)
CSlsuTable* pSLSU = new CSlsuTable(pDatabase); //CSlsuTable is my struct
ASSERT(pSLSU);
if (pSLSU)
if (BadFileTest(pSLSU,"su_key='I_CALC30'","slsu",pDatabase))
BOOL CGridApp::BadFileTest(struct cTableSet , CString strTableKey,CString strTableName,CDatabase* pDb) //I Can't get the struct
.
.
.
cTableSet* pTable = new cTableSet(pDb);
ASSERT(pTable);
if(pTable)
{
while(TRUE)
{
nret = IDNO;
pTable->m_strFilter.Empty();
pTable->m_strFilter = _T(strTableKey);
strSQL = _T("SELECT ");
strSQL += pTable->m_strDefaultSQL;
Does this make any sense at all? is it possible to do this someway?
|
|
|
|
|
Another thought I had on this ... is there anyway to pass the structure name as a string and then use that to declare my structure within the function? is this possible? Puzzled Emoticon
Ex:
BadFileTest("CSLSUtable","su_key='I_CALC30'","slsu",pDatabase)
BOOL CGridApp::BadFileTest(CString cTableSet , CString strTableKey,CString strTableName,CDatabase* pDb) //I Can't get the struct
.
.
.
cTableSet* pTable = new cTableSet(pDb);
ASSERT(pTable);
|
|
|
|
|
ts74 wrote:
is this possible?
nope. C++ isn't that flexible.
the best you can do is use some kind of mapping from text string to internal structure.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
It doesn't make a lot of sense but firstly,
ts74 wrote:
CSlsuTable* pSLSU = new CSlsuTable(pDatabase); //CSlsuTable is my struct
ASSERT(pSLSU);
if (pSLSU)
if (BadFileTest(pSLSU,"su_key='I_CALC30'","slsu",pDatabase))
pSLSU is a CSlsuTable class but your function defintion uses struct cTableSet. This should be CSlsuTable* not struct cTableSet;
What are you actually trying to achieve, because what you've said and your code don't tally.
Michael
Time flies like an arrow. Fruit flies like a banana
|
|
|
|
|
It sounds like you want to select the appropriate structure based on your database query. That can easily be done with a virtual base class.
I think you need an Abstract Factory Pattern. Try a google search.
Todd Smith
|
|
|
|
|
I think the exact pattern the guy needs here is a Factory Method, which is similar to, but not the same as, Abstract Factory.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
What I am trying to do is simplify my program, I have a function in which I verify my tables are verified, the problem is that each table has it's own structure. I wanted to setup a new function where I could pass the structure value so I could validate my tables in one simple process instead of going thru this the long way (copy/paste). So I was trying to figure out a way to pass the structure along to a function, so I could play with it in my new verify function, and this is where I ran into problems...
|
|
|
|
|
This is a confusing discussion because I'm not sure that everyone knows what you understand and don't understand here ( you said you're new to VC++, so I don't intend this as an insult. Just trying to get to the core of the trouble ).
If you are having trouble understanding passing by value versus passing by reference, I'd be glad to explain it. It's pretty easy once you see what's going on.
If what you want is the ability to pass a structure (you should be using classes, by the way) that may have different member variables, then you probably need to understand virtual inheritance (which someone else mentioned) which gives you the ability to pass different inherited structures (classes) to the same function assuming they all have the same parent. I can explain this in more detail if you should desire as well.
Let me know and I'll try to help.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
I am having trouble getting the tooltips to come up for on a toolbar. The toolbar is on a dialog. I create the toolbar like, with the CBRS_TOOLTIPS flag.
if(!m_wndToolBar.Create(this, WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_TOOLTIPS) || !m_wndToolBar.LoadToolBar(IDR_TOOL_BAR))
ASSERT(FALSE);
I then handle the message
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipNotify)
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipNotify)
The OnToolTipNotify function looks like
BOOL CApply::OnToolTipNotify( UINT id, NMHDR * pNMHDR, LRESULT * pResult )
{
TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR;
UINT nID =pNMHDR->idFrom;
strcpy(pTTT->szText, "Click Here - Test");
return TRUE;
}
It comes to the OnToolTipNotify but when the tooltip pops up it gives me a bunch of boxes and junk with no text.
Can anybody see something wrong?
Thanks
|
|
|
|
|
hi all,
does anybody know a way to access to C..Doc (or C..View) variables from ANY class in a project ?
I've tried :
// in a constructor of another class
CMtsBaseDoc* pDocument = ((CMtsBaseView*)(AfxGetApp()->m_pMainWnd))->pDoc;
// and even this one..
CMtsBaseApp* pApp = (CMtsBaseApp*)AfxGetApp();<br />
CMtsBaseDoc* pDocument = (pApp->GetMyView())->pDoc;
but nothing ! I just cannot get the right @ for my pDocument !? 'cos pDoc and pDocument should have the same @... and i get 2 different @
any help
thanx
Fred
|
|
|
|
|
CTtDoc *pDoc=(CTtDoc *)((CMainFrame *)AfxGetApp()->m_pMainWnd)->GetActiveDocument();
|
|
|
|
|
Hello,
I tried using this in a DialogBar function to point back to the Document function to get some UINT values.
When calling the function from the Document, it works fine.
However, when calling it from the DialogBar using the pDoc pointer, the Document function cannot access any of the Document's members--even the debugger cannot "evaluate" the member variables. Both function and members are public in my case.
So it appears that this pointer is not a full-feature pointer....? I'm interested both in a solution to get Document function (data) from 'remote' classes such as my DialogBar AND (academically) what is going on in this case--why doesn't it work from a nuts & bolts standpoint.
Thanks!
JennyP
|
|
|
|
|
After trying the first example and it not working (see my previous post), I tried the following and it worked. I guess the first compiles, but the pointer points not to where the actual data is stored but rather an empty data structure? (Just my WAG.) It seems the "GetActiveFrame()" may be important. If someone could explain the technical reasons, I'd appreciate it. Thanks!
CTtDoc *pDoc=(CTtDoc *)((CMainFrame *)AfxGetApp()->m_pMainWnd)->GetActiveFrame()->GetActiveDocument();
JennyP
|
|
|
|
|
even by doind so, i've got a descent value of pDoc but the values it holds are all set to 0 ?
i keep looking....
|
|
|
|
|
Now that I think of it, my values were zero, but I expected them to be zero. I'll have to set my values to be some non-zero value and see what happens. If they remain zero, then it's likely pointing to a new and separate instance of CDoc that was just created.... hmmm...
JennyP
|
|
|
|
|
I found that I have the exact same problem. I'm going to cludge around it by passing the other class's pointer to CDoc and doing it in reversed. It's worked for me before.
If you find a solution, I'd be VERY interested! Thanks!
JennyP
|
|
|
|
|
Actually, I found that my pDoc (attained as shown in previous messages above) DOES WORK.
I had another problem with my pDoc->Function that returned 0s.
Anyway,..... works for me.... maybe you should double check your document values? I saw the values were good in the debugger and simply was being returned incorrectly from a function.
Good luck.
JennyP
|
|
|
|
|
it's alright i found my mistake : a problem of where i declared the pDocument !
so now this part of code works fine, and i get access to the real values, all good.
PgGPS::PgGPS() : CPropertyPage(PgGPS::IDD)<br />
{<br />
pDocument = NULL;<br />
pDocument = (CMtsBaseDoc*)((CMainFrame*)AfxGetApp()->m_pMainWnd)->GetActiveFrame()->GetActiveDocument();<br />
<br />
}
by doing so in the constructor pDocument, accessible anywhere within the class, allows you to access to all the variables and methods in C..Doc.
Fred
|
|
|
|
|
I think your applcation is a base on MDI,so you must invoke GetActiveFrame.and mine is base on SDI,so....
|
|
|
|