|
|
|
|
I create a windows form apllication, p2pport.
My form file name is Dlg.I get some errors.
error C2027: use of undefined type 'p2pport::CParams'
error C2227: left of '->setValue' must point to class/struct/union/generic type
in Dlg.cpp
params->setValue("Y", "123");
in my Dlg.h file
#include "params.h";<br />
namespace p2pport {<br />
<br />
using namespace System;<br />
...............................<br />
<br />
public ref class Dlg : public System::Windows::Forms::Form<br />
{<br />
CParams* params;<br />
}<br />
}
in my param.h file
class CParams{<br />
void setvalue(char* k, char* v);<br />
}
in my params.cpp
void CParams::setValue(char* k, char* v){ ..... return; }
Can anybody tell me what's wrong with it?
Appreciate your reply.
Jane
|
|
|
|
|
Have you declared the pointer to your class before using it?
#include "MyClass.h"
MyClass* pMC;
pMC->DoSomething (...);
will work, but...
#include "MyClass.h"
pMC->DoSomething (...);
will give you the error you are posting
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
THx for reply.
Is that means I can't declare it in Dlg.h?
I have to put "MyClass* pMC;" to Dlg.cpp?
Jane
|
|
|
|
|
I dont say that you can not, I made it in header with member variables and in code with the local variables.
I have given you an example of that error code and the meaning. I don't think just putting the MyClass* pMC; in your Dlg.cpp will solve it. Although you can try it as well.
I think is more a question about the scope and how the relationships between classes are done. Your code is not recognising the other class, there is a point where the connections break.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
this is a Managed C++ question, so you should ask in the C++/CLI Forum[^]
thanks
|
|
|
|
|
I have an MFC DLL project written in VS2003. I upgraded it to VS2005 SP2 and successfully build the DLL, despite setting the project options to use the projects .PDB I am unable to debug the DLL.
I was able to debug happily with VS2003 but CANNOT debug with VS2005! I have rolled back to VS2003 as until I can debug I will not be using VS2005.
Has anyone else had this problem with VS2005, and did you manage to debug a DLL?
|
|
|
|
|
Check that your VS finds a dll with all the debug informations.
I debug VS2003 dlls with a VS2005 exe sometimes.
Greetings from Germany
|
|
|
|
|
Yes, the projects .PDB file is output to the same folder in which my debug DLL is located as well as the EXE being run from which the DLL is called.
I can debug the VS2003 version of the DLL fine, just when I convert the DLL project to VS2005 and build in debug mode I cannot debug. I have even set the Debuggong | Symbols | location to the path to the <projectname>.pdb, but alas not able to hit my breakpoints!
I am sure there is a bug in VS2005 being unable to debug MFC DLL's!!! But would welcome anyone who has managed to debug an MFC DLL in VS2005.
|
|
|
|
|
Andy H wrote: I am sure there is a bug in VS2005 being unable to debug MFC DLL's!!!
Visual Studio will always have its problems, but that isn't one of them.
I would clean the solution and shut down VS. Then delete ALL intermediate files
including pdb, ilk - everything. Get rid of the Intellisense database as well.
Fire up VS and do a full rebuild. If it still won't work, you've got a project settings
issue somewhere.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks, I'll give it a go.
|
|
|
|
|
I have two click events in my application. One is for open and read a file.
<br />
void CSRFDBDlg::OnBnClickedRead()<br />
{<br />
char * FilePath = "ReadFile.txt";<br />
CFile FileRead;<br />
<br />
if(FileRead.Open(FilePath, CFile::modeRead))<br />
{<br />
}<br />
}<br />
On next click event browse the file,
<br />
void CSRFDBDlg::OnBnClickedCtrl()<br />
{<br />
CFileDialog dlg( true, NULL, _T("*.*"), OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_NOCHANGEDIR, "textfiles(*.*)|*.*|*.*" );<br />
if(dlg.DoModal() != IDCANCEL)<br />
{<br />
<br />
CString filename = dlg.GetPathName();<br />
CBrowsePath.SetWindowText(filename);<br />
}<br />
}<br />
Now what I want to do is connect the "filename" with "FilePath" and connect them together. How should I do that. I worried because FilePath is used as char pointer.
I appreciate your help all the time...
Eranga
|
|
|
|
|
You can use a member variable to hold the data, and cast to the type of variable you need in every step.
I have used CString in both ways, with CFile and with CFileDialog and had no problems with it.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
You mean that file path should set using a CString?
I appreciate your help all the time...
Eranga
|
|
|
|
|
you can define your variable as
CString FilePath in your class CSRFDBDlg and can use them in both the click events.
any more clarifications required?
good luck.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
Can you explain how can I do it with my code.
Can I do it by replacing char * FilePath from CString filename . Have to declared it as a global variable? right...
I appreciate your help all the time...
Eranga
|
|
|
|
|
Eranga Thennakoon wrote: Can I do it by replacing char * FilePath from CString filename
yes you can.
global variable will also do. but defining it in the class will be better.
good luck.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
I don't say, "should" or "must". I say "can"
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
I got it, use a globally defined CString to hold the path and use. But now I have another question. On my browse path class it gives the path like in following format.
G:\Work On\CPP\SRFDB\ReadFile.txt
It gives a runtime error. Immediately after \ sign, it check it as a Escape Sequence. But it not found. That mean I want change the path as follows,
G:\\Work On\\CPP\\SRFDB\\ReadFile.txt
How can I go it.
I appreciate your help all the time...
Eranga
|
|
|
|
|
CString::Find (..);
CString::InsertAt (...);
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Hi,
I have this VC++ application through which i invoke help files by pressing F1 key. But when i modified the help files(both .cnt and .hlp through ROBOHELP)and included these new help files, F1 is no longer working though i can see Table of Contents. Am i missing any mapping somewhere?? Please suggest.
Thanks,
Aparna
|
|
|
|
|
Had those changes something to do with the structure of the help? Maybe you made a change that allows you to see the table of contents, but made a problem with the indexation of the direct access to a part of the help.
I hope you understand what I try to mean
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Hi,
Thanks for the reply!!
The application is actually an installable.Its installed in the machine...Now I just added a bit of text to some part of the Contents and recompiled the help files and then copied the new files in program files->application folder.Should i be compiling the program too??
Thanks,
Aparna
|
|
|
|