Click here to Skip to main content
15,923,789 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Bitwise operations (Masking) Pin
cydd17-Oct-07 2:03
cydd17-Oct-07 2:03 
GeneralRe: Bitwise operations (Masking) Pin
chandu00417-Oct-07 2:08
chandu00417-Oct-07 2:08 
QuestionSocket Send-Receive Synchronization Pin
Syamlal S Nair16-Oct-07 23:58
Syamlal S Nair16-Oct-07 23:58 
AnswerRe: Socket Send-Receive Synchronization Pin
Cedric Moonen17-Oct-07 0:07
Cedric Moonen17-Oct-07 0:07 
AnswerRe: Socket Send-Receive Synchronization Pin
ThatsAlok17-Oct-07 1:40
ThatsAlok17-Oct-07 1:40 
AnswerRe: Socket Send-Receive Synchronization Pin
David Crow17-Oct-07 3:43
David Crow17-Oct-07 3:43 
AnswerRe: Socket Send-Receive Synchronization Pin
led mike17-Oct-07 4:26
led mike17-Oct-07 4:26 
QuestionPrint Preview Pin
AnayKulkarni16-Oct-07 23:53
AnayKulkarni16-Oct-07 23:53 
hello to all,
right now i am doing a project in which i have created two new view classes, other than regular view class which gets created at the time of creating ur application.Lets say those two view classes are "CA1View" and "CB1View" and after that i followed a general method for print previewing which we normally follows i.e created a view class "CReportPreview" which has a base class as "CPreviewView" and wrote methods in it which contains the code of previewing, when i access A1View then i destroy B1View and viceversa, now to get an idea where i am getting error plz refer following code,

In "CA1View" class,

CPrintPreviewState::CPrintPreviewState()
{
// set defaults
nIDMainPane = AFX_IDW_PANE_FIRST;
//nIDMainPane = 1 ;
dwStates = AFX_CONTROLBAR_MASK(AFX_IDW_STATUS_BAR);
// status bar visible if available

hMenu = NULL;
pViewActiveOld = NULL;
//hAccelTable = NULL;
}

void CA1View::OnPrintPreview()
{
CPrintPreviewState* pState = new CPrintPreviewState;

// get default print info

if(!DoPrintPreview(AFX_IDD_PREVIEW_TOOLBAR, this,
RUNTIME_CLASS(CReportPreview), pState))
{
// In derived classes, reverse special window handling here for
// Preview failure case.
TRACE0("Error: DoPrintPreview failed.\n");
AfxMessageBox(AFX_IDP_COMMAND_FAILURE);
delete pState; // Preview failed to initialize, delete State
}

// CView::OnFilePrintPreview();

}

--------------------------------------------------------------------------
In "CB1View" class,

CPrintPreviewState::CPrintPreviewState()
{
// set defaults
nIDMainPane = AFX_IDW_PANE_FIRST;
//nIDMainPane = 1 ;
dwStates = AFX_CONTROLBAR_MASK(AFX_IDW_STATUS_BAR);
// status bar visible if available

hMenu = NULL;
pViewActiveOld = NULL;
//hAccelTable = NULL;
}

void CB1View::OnPrintPreview()
{
CPrintPreviewState* pState = new CPrintPreviewState;

// get default print info

if(!DoPrintPreview(AFX_IDD_PREVIEW_TOOLBAR, this,
RUNTIME_CLASS(CReportPreview), pState))
{
// In derived classes, reverse special window handling here for
// Preview failure case.
TRACE0("Error: DoPrintPreview failed.\n");
AfxMessageBox(AFX_IDP_COMMAND_FAILURE);
delete pState; // Preview failed to initialize, delete State
}

// CView::OnFilePrintPreview();

}

but when i rebuild the code i get following linker errors,

1)
B1View.obj : error LNK2005: "public: __thiscall CPrintPreviewState::CPrintPreviewState(void)" (??0CPrintPreviewState@@QAE@XZ) already defined in A1View.obj

2)
B1View.obj : error LNK2005: "public: int __thiscall CView::DoPrintPreview(unsigned int,class CView *,struct CRuntimeClass *,struct CPrintPreviewState *)" (?DoPrintPreview@CView@@QAEHIPAV1@PAUCRuntimeClass@@PAUCPrintPreviewState@@@Z
) already defined in A1View.obj

3)
Debug/Program.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

what to do? can any body help me plz its urgent plz

Thanks and Regards,



Anay
AnswerRe: Print Preview Pin
Nelek17-Oct-07 0:13
protectorNelek17-Oct-07 0:13 
GeneralRe: Print Preview Pin
David Crow17-Oct-07 3:40
David Crow17-Oct-07 3:40 
JokeRe: Print Preview Pin
Nelek17-Oct-07 5:30
protectorNelek17-Oct-07 5:30 
GeneralRe: Print Preview Pin
ThatsAlok17-Oct-07 20:29
ThatsAlok17-Oct-07 20:29 
QuestionRe: Print Preview Pin
David Crow17-Oct-07 3:42
David Crow17-Oct-07 3:42 
QuestionMake Main Thread sleep [modified] Pin
GauranG Shah16-Oct-07 23:47
GauranG Shah16-Oct-07 23:47 
AnswerRe: Make Main Thread sleep Pin
toxcct16-Oct-07 23:52
toxcct16-Oct-07 23:52 
GeneralRe: Make Main Thread sleep Pin
GauranG Shah17-Oct-07 0:11
GauranG Shah17-Oct-07 0:11 
GeneralRe: Make Main Thread sleep Pin
ThatsAlok17-Oct-07 1:24
ThatsAlok17-Oct-07 1:24 
AnswerRe: Make Main Thread sleep Pin
chandu00416-Oct-07 23:56
chandu00416-Oct-07 23:56 
AnswerRe: Make Main Thread sleep Pin
chandu00417-Oct-07 0:46
chandu00417-Oct-07 0:46 
GeneralRe: Make Main Thread sleep Pin
GauranG Shah17-Oct-07 1:40
GauranG Shah17-Oct-07 1:40 
GeneralRe: Make Main Thread sleep Pin
chandu00417-Oct-07 1:51
chandu00417-Oct-07 1:51 
GeneralRe: Make Main Thread sleep Pin
JudyL_MD17-Oct-07 1:51
JudyL_MD17-Oct-07 1:51 
GeneralRe: Make Main Thread sleep Pin
ThatsAlok17-Oct-07 2:01
ThatsAlok17-Oct-07 2:01 
GeneralRe: Make Main Thread sleep Pin
GauranG Shah17-Oct-07 2:28
GauranG Shah17-Oct-07 2:28 
GeneralRe: Make Main Thread sleep Pin
JudyL_MD17-Oct-07 2:42
JudyL_MD17-Oct-07 2:42 

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.