Click here to Skip to main content
15,915,172 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Help to sort a vector of CObject! Pin
bosfan27-Apr-07 1:47
bosfan27-Apr-07 1:47 
QuestionC++ text button save Pin
Anka_Ame26-Apr-07 3:56
Anka_Ame26-Apr-07 3:56 
AnswerRe: C++ text button save Pin
David Crow26-Apr-07 3:57
David Crow26-Apr-07 3:57 
QuestionRe: C++ text button save Pin
GuyM26-Apr-07 4:07
GuyM26-Apr-07 4:07 
QuestionRe: C++ text button save Pin
Rajesh R Subramanian26-Apr-07 8:05
professionalRajesh R Subramanian26-Apr-07 8:05 
AnswerRe: C++ text button save Pin
Hamid_RT26-Apr-07 21:45
Hamid_RT26-Apr-07 21:45 
QuestionCeSeekDatabaseEx() problem. [modified] Pin
mahendra.pardeshi26-Apr-07 3:43
mahendra.pardeshi26-Apr-07 3:43 
QuestionMFC DLL Static Const CString Not Resolved (LNK2001) Pin
Peter Saint26-Apr-07 2:57
Peter Saint26-Apr-07 2:57 
Hi,

I need some help. I'm trying to figure out the correct way to expose a "static const CString" value belonging to a class defined in an MFC DLL.

I have a class that I've encapsulated in a regular MFC DLL. The associated ".h" file looks like this:

class __declspec(dllexport) MyClass
{
public:
static const CString MY_CONST_STRING;
MyClass();
virtual ~MyClass();
void myFunc();
};

I have defined the value of MY_CONST_STRING in the class' ".cpp" file:

#include "MyClass.h"
const CString MyClass::MY_CONST_STRING = "Hello";

Although clients using the DLL can access the class (e.g., instantiate objects, call its member functions), they cannot seem to access the definition of the CString constant I have defined. When they try, they receive the following linker error:

error LNK2001: unresolved external symbol

I've defined CString constants this way in the past and referenced them without any problems, but this is the first time I've used one that was defined in an external MFC DLL class. I'm sure there's a simple answer.

Any and all help appreciated.

Thanks.

Peter
AnswerRe: MFC DLL Static Const CString Not Resolved (LNK2001) Pin
KarstenK26-Apr-07 3:34
mveKarstenK26-Apr-07 3:34 
AnswerRe: MFC DLL Static Const CString Not Resolved (LNK2001) Pin
Cedric Moonen26-Apr-07 3:42
Cedric Moonen26-Apr-07 3:42 
GeneralRe: MFC DLL Static Const CString Not Resolved (LNK2001) Pin
Peter Saint26-Apr-07 3:45
Peter Saint26-Apr-07 3:45 
AnswerRe: MFC DLL Static Const CString Not Resolved (LNK2001) Pin
GuyM26-Apr-07 3:51
GuyM26-Apr-07 3:51 
GeneralRe: MFC DLL Static Const CString Not Resolved (LNK2001) Pin
Peter Saint26-Apr-07 4:23
Peter Saint26-Apr-07 4:23 
GeneralRe: MFC DLL Static Const CString Not Resolved (LNK2001) Pin
GuyM26-Apr-07 4:30
GuyM26-Apr-07 4:30 
GeneralRe: MFC DLL Static Const CString Not Resolved (LNK2001) Pin
Peter Saint26-Apr-07 5:17
Peter Saint26-Apr-07 5:17 
GeneralRe: MFC DLL Static Const CString Not Resolved (LNK2001) Pin
Cedric Moonen26-Apr-07 3:57
Cedric Moonen26-Apr-07 3:57 
GeneralRe: MFC DLL Static Const CString Not Resolved (LNK2001) Pin
Peter Saint26-Apr-07 4:14
Peter Saint26-Apr-07 4:14 
QuestionProblem in fwrite and fread function [modified] Pin
mohindar_kks26-Apr-07 2:32
mohindar_kks26-Apr-07 2:32 
QuestionRe: Problem in fwrite and fread function Pin
David Crow26-Apr-07 2:43
David Crow26-Apr-07 2:43 
AnswerRe: Problem in fwrite and fread function Pin
mohindar_kks26-Apr-07 3:08
mohindar_kks26-Apr-07 3:08 
AnswerRe: Problem in fwrite and fread function Pin
Mark Salsbery26-Apr-07 7:15
Mark Salsbery26-Apr-07 7:15 
GeneralRe: Problem in fwrite and fread function Pin
David Crow26-Apr-07 8:00
David Crow26-Apr-07 8:00 
QuestionSHFileOperation and SendMessage Question Pin
Programm3r26-Apr-07 2:22
Programm3r26-Apr-07 2:22 
AnswerRe: SHFileOperation and SendMessage Question Pin
Programm3r26-Apr-07 2:27
Programm3r26-Apr-07 2:27 
GeneralRe: SHFileOperation and SendMessage Question Pin
Mark Salsbery26-Apr-07 7:16
Mark Salsbery26-Apr-07 7:16 

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.