|
Hi all,
I have this helper header file located at a common folder it is linked to my project right however I am getting these errors:
2>PrefDlg.obj : error LNK2019: unresolved external symbol "void __cdecl SendCtrlEndToWnd(char *)" (?SendCtrlEndToWnd@@YAXPAD@Z) referenced in function "public: long __thiscall CPrefDlg::OnButtonViewlogfile(unsigned short,unsigned short,struct HWND__ *,int &)" (?OnButtonViewlogfile@CPrefDlg@@QAEJGGPAUHWND__@@AAH@Z)
2>PrefDlg.obj : error LNK2019: unresolved external symbol "void __cdecl ClsMulWnd(char *)" (?ClsMulWnd@@YAXPAD@Z) referenced in function "public: long __thiscall CPrefDlg::OnButtonViewlogfile(unsigned short,unsigned short,struct HWND__ *,int &)" (?OnButtonViewlogfile@CPrefDlg@@QAEJGGPAUHWND__@@AAH@Z)
2>PrefDlg.obj : error LNK2019: unresolved external symbol "void __cdecl SetDateStr(char *)" (?SetDateStr@@YAXPAD@Z) referenced in function "public: long __thiscall CPrefDlg::OnButtonViewlogfile(unsigned short,unsigned short,struct HWND__ *,int &)" (?OnButtonViewlogfile@CPrefDlg@@QAEJGGPAUHWND__@@AAH@Z)
2>D:\SVN\Licensin System\Work Package\UpdateManager\Debug\UpdatePanel.cpl : fatal error LNK1120: 3 unresolved externals
I am a bit surprised as to why I am getting this but not on the other functions located at the helper header.
Is there something I forgot to do here?
Thanks,
Jayjay
|
|
|
|
|
Have you included the header file where you are calling those functions?
--
"Programming is an art that fights back!"
|
|
|
|
|
|
i got it now i forgot to include the header in the project headers sheeesh
|
|
|
|
|
Hello everyone,
Mentioned here, in section "Single-Threaded Apartment (STA)",
http://msdn.microsoft.com/en-us/library/ms809311.aspx
1. when making outgoing calls to other apartment in STA, the owner thread of STA is not blocked and continue to do message pump, it is the RPC thread (which is responsible for sending marshalled result to destination apartment) is blocked?
2. when the STA owner thread executes method DispatchMessage in message pump loop, DispatchMessage will use the same owner thread to send message to hidden window, also use the same owner thread to unmarshall through proxy, and the same owner thread to execute desired COM method?
thanks in advance,
George
|
|
|
|
|
can i take a good example about file filter by shell extension?
user may register some files to the extension module,
and then those registered files are not listed in explorer.
that's all.
help me.
|
|
|
|
|
Hi, I have a MFC Doc/View SDI application that in CDocument it opens a dialog box I need this dialog box to send and get data to the CDocument without halting the thread so I created a Mode less dialog box (CDialog m_dlgCalibrate),Now my problem is How can I send a message from this dialog box to CDocument
class. In CDocument class that I create this calibration dialog box I've
assigned its parent the CView associated with CDocument(I have only one view)
This is the code
void CMyDoc::OnCommandsCalibrate()
{
bool res;
POSITION pos = GetFirstViewPosition();
res = m_dlgCalibrate.Create(IDD_CALIBRATE, GetNextView(pos));
if(!res)
AfxMessageBox(_T("Error Creating Dialog Box"));
m_dlgCalibrate.ShowWindow(SW_SHOW);
}
So when in this calibration dialog box I executed
PostMessage(WM_CAL_COMMAND);
I expected it is routed to CMyView
I have put this in CMyView Message map
ON_MESSAGE(WM_CAL_COMMAND, CMyView::OnNewCalCommand)
I also have defined handler function as:
afx_msg LRESULT OnNewCalCommand(WPARAM, LPARAM);
but this message won't reach to CMyView let alone CMyDoc
but I could grab it in CMainFrame class using similar code(I only
executed AfxGetMainWnd()->PostMessage(WM_CAL_COMMAND) in dialog box in this
case). Is there anyway so I can post this message to CMyDoc directly or at
least to CMyView?
Thanks
|
|
|
|
|
Hi,
Is there any chance of giving the DialogBox a reference to your CMyDoc and then executing m_pMyDoc->OnCalibrate() directly in your CMyDialog::OnOK(). You are trying to use the Framework Message Routing Mechanism which was designed to implement MFC. I'm not sure how it routes WM_USER+x Messages. From your experiment it occurs to me that the message ends up in the BitBucket somewhere along the way.
Hope this is helpfull,
Regards
Bram van Kampen
|
|
|
|
|
Hi, I tried but I couldn't because it requires that I have a member variable of dialog box in CDocument class, so I have to include CDialog header file in CDocument header file in that case I also need to define a member variable that points to CDocument so I also need to include CDocument header file in CDialog header file and this causes the compiler to cry loudly and gives hundreds of errors I even tried to prevent compiler form reading a header file recursively. like this:
#ifndef __CDOCUMENT_H_
#define __CDOCUMENT_H_
.....
#endif
but again it wouldn't satisfy the compiler.
Regards ,
|
|
|
|
|
Electronic75 wrote: Hi, I tried but I couldn't because it requires that I have a member variable of dialog box in CDocument class, so I have to include CDialog header file in CDocument header file in that case I also need to define a member variable that points to CDocument so I also need to include CDocument header file in CDialog header file and this causes the compiler to cry loudly and gives hundreds of errors I even tried to prevent compiler form reading a header file recursively. like this:
Well, read up on your cpp. Ofcource the compiler (and largely the Framework) will object if you start adding items willy nilly to CDocument. After you eventually convince the compiler that way, the Linker will complain more loudly! (and should do so!)
The crucial issue is that you have derrived a class CMyDocument, from CDocument. Again, Read up on CPP, Place your Dlg Header in 'MyDocument.h"
and you can call it from CMyDocument (but NOT from CDocument except by virtual function.)
Regards,
Bram van Kampen
|
|
|
|
|
Hi, My mistake from CDocument and CDialog I meant a CDocument/CDialog derived class i.e. CMyDocument/CMyDialog
and the code was like this,
#ifndef C_MY_DOC_H_
#define C_MY_DOC_H_
...
#endif
Regards,
|
|
|
|
|
Whats wrong with doing this from your Dialog:
CFrameWnd * pFrame = (CFrameWnd *)(AfxGetApp()->m_pMainWnd);
CDocument * pDoc = pFrame->GetActiveDocument();
if(NULL != pDoc)
{
pDoc->SomeFunction();
}
Best Wishes,
-David Delaune
|
|
|
|
|
Thanks a lot David, That solved my current problem but for future and just for knowledge purpose is there anyway to post a message directly to CDocument class from a dialog box I mean is there a way to override default message parsing scheme of MFC and route a message to a specific location?
I read something about message reflection but as far as I understood that's most useful when one wants to propagate a message to child descendants and in my case can't do the trick how about overriding CCmdTaget?
Thanks
Best wishes,
|
|
|
|
|
Hi,
I am working on an MFC application using VC6.0
Now I have to add an RPC client module in my application.
I am able to generate client and server stubs using MIDL compiler.
Now when I am trying to compile my client application with client stub and
header file,I am getting linker errors like
unresolved external symbol __imp__RpcBindingFree@4
unresolved external symbol __imp__RpcStringFreeA@4
unresolved external symbol __imp__RpcBindingFromStringBindingA@8
unresolved external symbol __imp__RpcStringBindingComposeA@24
unresolved external symbol __imp__NdrFreeBuffer@4
unresolved external symbol __imp__NdrSendReceive@8
unresolved external symbol __imp__NdrConformantStringMarshall@12
unresolved external symbol __imp__NdrGetBuffer@12
unresolved external symbol __imp__NdrConformantStringBufferSize@12
unresolved external symbol __imp__NdrClientInitializeNew@16
unresolved external symbol __imp__RpcRaiseException@4
Do I need to add any library, if So please tell me how to import and link it.
Regards,
Sunil Kumar
|
|
|
|
|
Add Rpcrt4.lib to your linker settings.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Yeah , Thanks for the reply. I didnt add the RPCRT4.lib file before.
Now I am able to compile it.
Regards,
Sunil Kumar
|
|
|
|
|
i want to improve my question...
how to make application installer from mfc and opengl.
because i use opengl on my mfc....
please anyone...
|
|
|
|
|
Hello,
I have a dialog through which users of my application can get various reports. They select a date from a calender, and click the dialog's OK button. Then, a new frame is spawned with the report. So far, so good. However, because OnOK() is called, the newly spawned frame is immediately placed behind the main frame(window). This is obviously undesirable. How can I close the dialog, but still have the new frame spawn in front of existing main frame? I've tried doing things like calling EndDialog(0), or OnCancel, which would have been acceptable solutions, had they worked
What Should I do?
Thanks,
Sternocera
|
|
|
|
|
HKEY hKey;
CString path;
hKey = HKEY_LOCAL_MACHINE;
err = ERROR_SUCCESS;
m_list.InsertItem(0, "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products\\109C30587D582624882DD8B8A2B7808B");
path = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products\\109C30587D582624882DD8B8A2B7808B";
err = RegOpenKeyEx(hKey, path, NULL, KEY_ALL_ACCESS, &hKey);
if (err == ERROR_SUCCESS)
{
m_list.SetItemText(0, 1, "Found");
ErrorExit("RegOpenKey0");
}
else
{
m_list.SetItemText(0, 1, "Not Found"); <--- this is the one i keep getting
ErrorExit("RegOpenKey1");
}
RegCloseKey(hKey);
that is the code and it keeps returning error 2 system cant find file but i know the path is good i copied the key from regedit i am on vista 64 bit if it makes a differance ill take any help i can get
|
|
|
|
|
locoone wrote: that is the code and it keeps returning error 2 system cant find file...
If the function fails, the return value is a nonzero error code defined in Winerror.h .
"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
|
|
|
|
|
that part i know the part i cant figure out is why it cant find it i was in regedit and used the copy key name to get the key path so i know its right out of 24 keys it finds 12 and cant find 12
modified on Saturday, August 9, 2008 11:28 PM
|
|
|
|
|
Do you get different results if you use KEY_QUERY_VALUE instead of KEY_ALL_ACCESS?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Unicode? If I recall correctly it's possible to have keys that regedit can't display correctly.
Thus, if you copy and paste you're not copying the entire key. I'd write a quick and dirty iteration
over the root key dumping the raw bytes in each key name to make sure you have the entire key.
|
|
|
|
|
I wrote the following header file. Actually, what I posted is only a subset of
the header file:
#include <assert.h>
using namespace std;
template class {T> class Polynomial {
public:
Polynomial <T>() : order(-1), coeff( 0 )
{
}
Polynomial <T> ( int order, ... );
T eval( T xValue );
Polynomial & Integrate();
void printIt( ostream &out );
friend ostream & operator << ( ostream &out, Polynomial<T> &poly );
private:
int order;
T *coeff; // Note the lower order terms of the polynomail go first. That
// is for the polynomial x^10 - 5 coeff[0] = -5, coeff[10] = 1
// and all the other values of coeff are 0.
};
typedef Polynomial<double> DoublePolynomial;
Now in the file, poly.cpp, I define the member functions for this class. I also
instantiated the class with the statement:
template class Polynomial<double>;
However, this does not instantiate the operator << . Therefore, if in the main
program I write something like:
cout << poly1 << endl;
where poly1 is of type Polynomail<double> I get an error from the linker. I believe that this
is due to the fact that I did not instantiate the operator << which is a friend of the class.
I am hoping that somebody can tell me how to do this.
Thanks
Bob
|
|
|
|
|
I've found this C++ Faq[^] helpfull on template linkage errors. I must admit that I usually put all the declarations in the header file myself to avoid the problems. Putting the declaration for operator << in the header file resolves the linker error.
I'm a bit puzzled why you bothered with the friend operator << at all, since you have a public printIt function, which presumably is called by the operator <<. The friend keyword allows the function access to the internals (private and protected) parts of the class, with a printIt method you don't need this.
You could get the same effect by putting a stand alone template function in the header instead, e.g.
template<class T>
ostream & operator << ( ostream &out, Polynomial<T> &poly )
{
poly.printIt(out);
return out;
}
Graham
Librarians rule, Ook!
|
|
|
|