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

C / C++ / MFC

 
AnswerRe: Vitual key, VS2005 Pin
Naveen18-Aug-06 19:57
Naveen18-Aug-06 19:57 
AnswerRe: Vitual key, VS2005 Pin
Justin Tay19-Aug-06 2:37
Justin Tay19-Aug-06 2:37 
QuestionSTL Map.find() Pin
shadrach_india18-Aug-06 19:38
shadrach_india18-Aug-06 19:38 
AnswerRe: STL Map.find() Pin
Stephen Hewitt20-Aug-06 16:07
Stephen Hewitt20-Aug-06 16:07 
QuestionPreviewing many pages Pin
mikobi18-Aug-06 19:09
mikobi18-Aug-06 19:09 
QuestionDrawing on the window [modified] Pin
ramanand_bulusu18-Aug-06 18:38
ramanand_bulusu18-Aug-06 18:38 
AnswerRe: Drawing on the window Pin
Hamid_RT18-Aug-06 19:33
Hamid_RT18-Aug-06 19:33 
QuestionAsk a unsolved problem for long time Pin
begtostudy18-Aug-06 16:38
begtostudy18-Aug-06 16:38 
I have 3 projects in workspace.I use VC 6.0.

project DipApi is a win32 static Library
They are all functions.

project CDib is MFC extension DLL,and use DibApi.lib
It will export a class.These is the header file Dib.h of the class,below
#include "..\DibApi\DIBAPI.H"
class AFX_EXT_CLASS CDib : public CObject
{
DECLARE_SERIAL(CDib) //serialization
......

export dll is ok.

CDibEx also is a MFC extension DLL project,use DibApi.lib too,and the upper class.
It will export a class too.These is the header file DibEx.h of the class,below
#include "..\dibapi\dibapi.h"
#include "..\cdib\Dib.h"
//This is the upper header file.I do not know whether to change it.
#define EFFECT_SCANDOWN 1
#define EFFECT_SCANUP 2
#define EFFECT_SCANRIGHT 3
class AFX_EXT_CLASS CDibEx : public CDib
{
DECLARE_SERIAL(CDibEx) //serialization
... ...
but ,when building,VC show:
Creating library Debug/CDibEx.lib and object Debug/CDibEx.exp
DibEx.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass

CDib::classCDib" (?classCDib@CDib@@2UCRuntimeClass@@A)
Debug/CDibEx.dll : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

Look for AFX_EXT_CLASS in MSDN.In Export and Import Using AFX_EXT_CLASS,it has
"For example, the DECLARE_DYNAMIC macro is defined as follows when building an extension

DLL:

#define DECLARE_DYNAMIC(class_name) \
protected: \
static CRuntimeClass* PASCAL _GetBaseClass(); \
public: \
static AFX_DATA CRuntimeClass class##class_name; \
virtual CRuntimeClass* GetRuntimeClass() const; \

The line that begins with static AFX_DATA is declaring a static object inside of your

class. To export this class correctly and access the run-time information from a client

executable, you must export this static object. Because the static object is declared with

the modifier AFX_DATA, you only need to define AFX_DATA to be __declspec(dllexport) when

building your DLL and define it as __declspec(dllimport) when building your client

executable. Because AFX_EXT_CLASS is already defined in this way, you just need to

redefine AFX_DATA to be the same as AFX_EXT_CLASS around your class definition.

For example:

#undef AFX_DATA
#define AFX_DATA AFX_EXT_CLASS

class CExampleView : public CView
{
DECLARE_DYNAMIC()
// ... class definition ...
};

#undef AFX_DATA
#define AFX_DATA

"

I am sorry for knowing unclearly,so I did know whether it relate to my problem.
Actually,I want to make two class to dlls respectively.
But I don't know where I was wrong.Please tell me ,thanks a lot!


begtostudy
AnswerRe: Ask a unsolved problem for long time Pin
begtostudy19-Aug-06 20:40
begtostudy19-Aug-06 20:40 
Questionproblems with recvfrom Pin
afpr18-Aug-06 13:36
afpr18-Aug-06 13:36 
QuestionUsing #define with a dll Pin
Waldermort18-Aug-06 11:32
Waldermort18-Aug-06 11:32 
AnswerRe: Using #define with a dll Pin
Chris Losinger18-Aug-06 11:37
professionalChris Losinger18-Aug-06 11:37 
AnswerRe: Using #define with a dll Pin
cmk19-Aug-06 13:11
cmk19-Aug-06 13:11 
Questionfindresource xpsp2res.dll Pin
fx920018-Aug-06 7:09
fx920018-Aug-06 7:09 
Questionerror LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup [modified] Pin
sea200618-Aug-06 7:01
sea200618-Aug-06 7:01 
AnswerRe: error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup Pin
David Crow18-Aug-06 7:09
David Crow18-Aug-06 7:09 
AnswerRe: error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup Pin
Rule 7.6225-Dec-06 7:21
Rule 7.6225-Dec-06 7:21 
Questionreading and sending errors to serial port [modified] Pin
cahit2318-Aug-06 5:58
cahit2318-Aug-06 5:58 
AnswerRe: reading and sending errors to serial port Pin
cje22-Aug-06 10:43
cje22-Aug-06 10:43 
QuestionPrint Preview Orientation & many pages problems [modified] Pin
mikobi18-Aug-06 5:42
mikobi18-Aug-06 5:42 
Questionchar* to OLECHAR* ? Pin
great_tommy18-Aug-06 5:41
great_tommy18-Aug-06 5:41 
AnswerRe: char* to OLECHAR* ? Pin
David Crow18-Aug-06 6:22
David Crow18-Aug-06 6:22 
GeneralRe: char* to OLECHAR* ? Pin
great_tommy18-Aug-06 6:53
great_tommy18-Aug-06 6:53 
GeneralRe: char* to OLECHAR* ? Pin
David Crow18-Aug-06 7:08
David Crow18-Aug-06 7:08 
GeneralRe: char* to OLECHAR* ? Pin
great_tommy18-Aug-06 7:14
great_tommy18-Aug-06 7:14 

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.