|
Hello,
I have a simple application where I try to display a dialog with a timer. It builds fine in the debug mode but not in the release mode. This is the error I get:
MainFrm.obj : error LNK2001: unresolved external symbol "protected: long __thiscall CMainFrame::OnNotifyPowerOnTime(unsigned int,long)" (?OnNotifyPowerOnTime@CMainFrame@@IAEJIJ@Z)
Release/NotifyTimer.exe : fatal error LNK1120: 1 unresolved externals
Relevant Code:
////////////////////////////////////////////////
// CMainFrame
#define WM_NOTIFY_POWER_ON_TIME (WM_USER + 1)
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_MESSAGE(WM_NOTIFY_POWER_ON_TIME, OnNotifyPowerOnTime)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////
function definition
/////////////////////////////////
protected:
//{{AFX_MSG(CMainFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg LRESULT OnNotifyPowerOnTime(WPARAM,LPARAM);
//////////////////////////////////
//////////////////the function///////////
LRESULT CMainFrame::OnNotifyPowerOnTime(WPARAM, LPARAM lParam)
{
...
...
return (LRESULT) 0;
}
Any suggestions? Help??
Thankyou
Murali
-- modified at 19:54 Tuesday 11th April, 2006
|
|
|
|
|
Make sure that the OnNotifyPowerOnTime function implementation is not enclosed within a #ifdef DEBUG section (there is one around the Dump( ) and AssertValid( ) functions, it may have ended up inside that section).
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
Hi dabs,
You were right. The function was enclosed within a #ifdef _DEBUG section. I moved the function outside the #ifdef _DEBUG and recompiled and everything is fine. Thanks for your help.
Murali
|
|
|
|
|
LRESULT CMainFrame::OnNotifyPowerOnTime(WPARAM, LPARAM lParam)
{
...
...
return (LRESULT) 0;
}
where is the parameter of the wparam or is it ok...
Knock out "T" from CAN'T
You 'CAN' if you think you 'CAN'
|
|
|
|
|
Hi,
Do not need the actual parameter for WPARAM. As long as the defn. matches the decl. My code compiles fine in both the release (after the fix, thanks to dabs) and debug mode.
Murali
|
|
|
|
|
Does it make sense to use the .NET framework to develop a Win32 DLL that will reuse a lot of code from another project that uses MFC classes . I am going to stick to coding language as C++
If so what kind of solution ( project / language) is preferred ?
Engineering is the effort !
|
|
|
|
|
act_x wrote: Does it make sense to use the .NET framework to develop a Win32 DLL that will reuse a lot of code from another project that uses MFC classes
The answer is NO, it doesn't make any sense to me.
act_x wrote: I am going to stick to coding language as C++
Long live the Microsoft Visual C++ good choise!
act_x wrote: If so what kind of solution ( project / language) is preferred ?
I guest you known the answer to that question!
|
|
|
|
|
Sounds like you need to host an instance of the WebBrowser control. It's an ActiveX control so you'll to use MFC or ATL unless you want to implement the hosting code yourself (you almost certainly don't).
Steve
|
|
|
|
|
Stephen Hewitt wrote: It's an ActiveX control so you'll to use MFC or ATL unless you want to implement the hosting code yourself (you almost certainly don't).
Thanks for the tip... I'd like to know if you think I should use (MFC or ATL) as I'm trying to read .html files on disk and display them within a screensaver. What is the easiest way of accomplishing this goal? I have to use the method declaration that follows, and all I have to use is a handle to the screensaver window (hWnd):
LRESULT WINAPI ScreenSaverProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-- modified at 23:15 Tuesday 11th April, 2006
|
|
|
|
|
I have to send some data as XML format to two different places right now I send all the data to one location through a socket and I need to create another socket to send some other data to second location as follow:
If (data1)
send to LOC1
else
send to LOC2
and this LOC1 connection should always be open
at this point I have the socket and connection to LOC2
Please help me to know how to make the second connection to LOC1 for the first connection to LOC2 the code uses CfgRemoteAddr=127.0.0.1 and some local port: local 1222 and remote 1223.
as follow:
if( hCfg->CfgApiSocket->CfgTCP )
.
.
..
if( !hSocket->sSend( hCfg->CfgApiSocket->CfgRemoteAddr, 0, ( LPSTR )XMLString, XMLSize ))
{
//Socket::sSend( LPSTR Address, INT PortId, LPSTR txBuff, INT txBuffSize )
tmpVar = 0;
memset( Buff, '\0', MAX_LOADSTRING );
tmpVar = hSocket->GetError(( LPSTR )Buff );
LogError( "WEAPIClass", "InSockProcess", "Error sSend Socket: %d, %s", tmpVar, Buff );
LinkStatus( IPC_LINK_DOWN, 0, NULL, 0 );
}
else
{
LogAppDiag( LOGGER_INBOUND_DIAG, XMLString, XMLSize, LOG_FORMAT_ASCII );
}
Thanks for any idea
Nahitan
|
|
|
|
|
for pointer variables defined globally say CmemObject *pMem = NULL
For a class CMyClass
CMyClass::Init()
{
pMem = new CMemObject();
}
CMyClass :: ~CMyClass()
{
if(pMem)
{
delete pMem;
pMem = NULL ;
}
}
Still shows a leak where the new operator is called .
Is it safe to ignore this error as I am finally de allocating it ?
|
|
|
|
|
Are you sure the destructor for CMyClass is getting called AND pMem is not set to NULL somewhere else?
Regards
Senthil
_____________________________
My Blog | My Articles | My Flickr | WinMacro
|
|
|
|
|
im confident about this
Engineering is the effort !
|
|
|
|
|
Also, in Init() you should not allocate if already done so or call delete pMem before calling new. You don't have to check for NULL since by definition, nothing will happen if it is NULL.
If the allocation should never be called twice, add: assert(pMem == NULL)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Hi guys,
I was having a bit of trouble compiling a program of mine and was hoping someone kind enough could help me out.
Im desiging a simple program that basically sends an email by using sockets. However it looks like I'm getting linker errors. Here is the compiler generated report.
--------------------Configuration: sendEmailWinsock - Win32 Debug--------------------
Compiling...
sendEmailWinsock.cpp
Linking...
sendEmailWinsock.obj : error LNK2001: unresolved external symbol __imp__recv@16
sendEmailWinsock.obj : error LNK2001: unresolved external symbol __imp__connect@12
sendEmailWinsock.obj : error LNK2001: unresolved external symbol __imp__inet_addr@4
sendEmailWinsock.obj : error LNK2001: unresolved external symbol __imp__gethostbyname@4
sendEmailWinsock.obj : error LNK2001: unresolved external symbol __imp__htons@4
sendEmailWinsock.obj : error LNK2001: unresolved external symbol __imp__socket@12
sendEmailWinsock.obj : error LNK2001: unresolved external symbol __imp__WSAStartup@8
sendEmailWinsock.obj : error LNK2001: unresolved external symbol __imp__send@16
sendEmailWinsock.obj : error LNK2001: unresolved external symbol __imp__WSACleanup@0
sendEmailWinsock.obj : error LNK2001: unresolved external symbol __imp__closesocket@4
Debug/sendEmailWinsock.exe : fatal error LNK1120: 10 unresolved externals
Error executing link.exe.
sendEmailWinsock.exe - 11 error(s), 0 warning(s)
The environment I'm on is:
Windows XP Home
VC++ 6.0
I'm using registry functions within my program as well so I'm confident it is only to do with the winsock functions. I've been looking all over google for a solution but just when I think im close I'm pretty far away.
I'm thinking it's to do with my compiler options but not to sure if thats whats causing the problem. Any help is appreciated!
Robbie
|
|
|
|
|
Add Winsock.lib or Winsock2.lib to your link options. (Edit: Add under additional libraries.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
-- modified at 16:08 Tuesday 11th April, 2006
|
|
|
|
|
Hey Joe,
Thanks for your help that worked! Winsock.lib wasn't in my libraries but WSOCK32.lib was so I added that and it fixed the problem. Just an addition on my behalf in case anyone else has this problem in the future .
Thanks for the help once again
Robbie
|
|
|
|
|
Hi Jochen Kalmbach,
This is regarding the stackwalker sample code available in http://blog.kalmbachnet.de/files/04-10-01__leakfinder.htm.When I used this sample code in my application and try to build and execute it is working.When we copied the application "Exe" into other machine,we are not able to generate the same stack report.It is throwing the following error.
1: SymGetLineFromAddr(): GetLastError = 126.
Could you please help us in fixing this error.If possible can you post your mail id here
Thanks in Advance
PSB
p_shakil@yahoo.com
|
|
|
|
|
psbasha wrote: When we copied the application "Exe" into other machine...
What OS is it running?
psbasha wrote: 1: SymGetLineFromAddr(): GetLastError = 126.
Which resolves to "The specified module could not be found."
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
|
Does that machine have DbgHelp.dll v5.0 or later?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
|
psbasha wrote: Hi Jochen Kalmbach,
You calling Mr Kalmbach from this forum.. why don't you post your query on his Blog.. or generally mr Kalmbach could be found in microsoft.public.vc.mfc newsgroup
|
|
|
|
|
Hi ,
Help me in posting the query in microsoft.public.vc.mfc
Thanks
|
|
|
|
|
See here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|