Click here to Skip to main content
15,908,264 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Error regarding .sbr file in VC++ 2005 Pin
yudhisthira5-Aug-07 19:55
yudhisthira5-Aug-07 19:55 
GeneralRe: Error regarding .sbr file in VC++ 2005 Pin
Paresh Chitte5-Aug-07 20:02
Paresh Chitte5-Aug-07 20:02 
AnswerRe: Error regarding .sbr file in VC++ 2005 Pin
Shouvik Das5-Aug-07 19:48
Shouvik Das5-Aug-07 19:48 
GeneralRe: Error regarding .sbr file in VC++ 2005 Pin
yudhisthira5-Aug-07 19:55
yudhisthira5-Aug-07 19:55 
AnswerRe: Error regarding .sbr file in VC++ 2005 Pin
ThatsAlok5-Aug-07 19:53
ThatsAlok5-Aug-07 19:53 
GeneralRe: Error regarding .sbr file in VC++ 2005 Pin
yudhisthira5-Aug-07 19:56
yudhisthira5-Aug-07 19:56 
GeneralRe: Error regarding .sbr file in VC++ 2005 Pin
ThatsAlok5-Aug-07 20:20
ThatsAlok5-Aug-07 20:20 
Questionstatic member variable, dll export and multiple translation units Pin
devvvy5-Aug-07 15:43
devvvy5-Aug-07 15:43 
Here's a problem with static class member:

From DLL A - header:
<br />
class __declspec(dllexport) CLogEntry<br />
{<br />
public:<br />
        ...<br />
<br />
	static CLog* GetSingletonLoggingProvider() { return s_pSingletonLoggingProvider; }<br />
	...<br />
<br />
protected:<br />
         ...<br />
	static CLog * s_pSingletonLoggingProvider;<br />
};<br />


.cpp file:
#include "stdafx.h"<br />
<br />
#include "LogEntry.h"<br />
<br />
CLog * CLogEntry::s_pSingletonLoggingProvider = NULL; << NOTE I need to actually "define" the global variable - that's fine. (so long I don't need to do it multiple times)<br />
<br />
CLogEntry::CLogEntry(int nId, nsCLog::eSeverity nSeverity, char* lpszCode, char* lpszMsg, DWORD dwWin32ErrorCode, CLogEntry * pParent)<br />
{<br />
...<br />
}<br />
... the rest of it...<br />


Now from DLL B (The second dll which is linked to "DLL A")
.cpp file (where CLogEntry is used)
<br />
CLog * CLogEntry::s_pSingletonLoggingProvider = NULL; <br />

<< I need to define this again?? That looks like redundant code to me but if I don't, I'd get the following error.
<br />
Linking...<br />
   Creating library ..\..\bin/XXX.lib and object ..\..\bin/XXX.exp<br />
StdAfx.obj : error LNK2001: unresolved external symbol "protected: static class CLog * CLogEntry::s_pSingletonLoggingProvider" (?s_pSingletonLoggingProvider@CLogEntry@@1PAVCLog@@A)<br />
..\..\bin/XXX.exe : fatal error LNK1120: 1 unresolved externals


So I need to redefine (not "declare") the static member variable in each "Translation Unit"? (separate dll, exe?)

Thanks a bunch!
AnswerRe: static member variable, dll export and multiple translation units [modified*2] Pin
Mark Salsbery5-Aug-07 16:41
Mark Salsbery5-Aug-07 16:41 
GeneralRe: static member variable, dll export and multiple translation units Pin
devvvy5-Aug-07 18:42
devvvy5-Aug-07 18:42 
GeneralRe: static member variable, dll export and multiple translation units Pin
Mark Salsbery5-Aug-07 19:23
Mark Salsbery5-Aug-07 19:23 
GeneralRe: static member variable, dll export and multiple translation units [modified*2] Pin
devvvy5-Aug-07 22:17
devvvy5-Aug-07 22:17 
GeneralRe: static member variable, dll export and multiple translation units Pin
Mark Salsbery6-Aug-07 4:59
Mark Salsbery6-Aug-07 4:59 
GeneralRe: static member variable, dll export and multiple translation units [modified*2] Pin
devvvy5-Aug-07 22:24
devvvy5-Aug-07 22:24 
GeneralRe: static member variable, dll export and multiple translation units Pin
Mark Salsbery6-Aug-07 5:01
Mark Salsbery6-Aug-07 5:01 
GeneralRe: static member variable, dll export and multiple translation units Pin
devvvy6-Aug-07 13:57
devvvy6-Aug-07 13:57 
GeneralRe: static member variable, dll export and multiple translation units Pin
Mark Salsbery6-Aug-07 14:22
Mark Salsbery6-Aug-07 14:22 
Question2 dim numbers.. Pin
_80865-Aug-07 7:54
_80865-Aug-07 7:54 
AnswerRe: 2 dim numbers.. Pin
Maxwell Chen13-Aug-07 0:56
Maxwell Chen13-Aug-07 0:56 
Questionabout static libraries Pin
mt_samiei5-Aug-07 4:01
mt_samiei5-Aug-07 4:01 
QuestionRe: about static libraries Pin
Mark Salsbery5-Aug-07 7:40
Mark Salsbery5-Aug-07 7:40 
QuestionHighlight text in static control Pin
Legolas655-Aug-07 1:55
Legolas655-Aug-07 1:55 
AnswerRe: Highlight text in static control Pin
Hamid_RT5-Aug-07 3:49
Hamid_RT5-Aug-07 3:49 
GeneralRe: Highlight text in static control Pin
Legolas655-Aug-07 6:31
Legolas655-Aug-07 6:31 
GeneralRe: Highlight text in static control Pin
Hamid_RT5-Aug-07 19:02
Hamid_RT5-Aug-07 19:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.