Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Calendar
  New Posts New Posts RSS Feed - Error when used in combination with XTP
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Error when used in combination with XTP

 Post Reply Post Reply
Author
Message
Martin View Drop Down
Newbie
Newbie
Avatar

Joined: 26 April 2005
Location: Netherlands
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote Martin Quote  Post ReplyReply Direct Link To This Post Topic: Error when used in combination with XTP
    Posted: 18 May 2005 at 6:20am
Hello,
 
yesterday I downloaded the Calendar component and now I am trying to implement it
in our existing piece of software which now also support the XTreme Toolkit Pro.
 
Now I want to use the calendar component with the toolkit but I get a bunch
of linker errors:
 
Generating Code...
Linking...
LINK : warning LNK4108: /ALIGN specified without /DRIVER or /VXD; image may not run
XCP9700BetaLibDynStatic.lib(XTPCalendarPaintManager.obj) : error LNK2005: "public: __thiscall CXTPPaintManagerColor::operator unsigned long(void)" (
??BCXTPPaintManagerColor@@QAEKXZ) already defined in XTP9601Lib.lib(XTP9601Lib.dll)
XCP9700BetaLibDynStatic.lib(XTPDrawHelpers.obj) : error LNK2005: "public: __thiscall CXTPPaintManagerColor::operator unsigned long(void)" (
??BCXTPPaintManagerColor@@QAEKXZ) already defined in XTP9601Lib.lib(XTP9601Lib.dll)
XCP9700BetaLibDynStatic.lib(XTPDrawHelpers.obj) : error LNK2005: "public: __thiscall CXTPEmptyRect::CXTPEmptyRect(void)" (
??0CXTPEmptyRect@@QAE@XZ) already defined in XTP9601Lib.lib(XTP9601Lib.dll)
XCP9700BetaLibDynStatic.lib(XTPDrawHelpers.obj) : error LNK2005: "public: __thiscall CXTPWindowRect::CXTPWindowRect(class CWnd const *)" (
??0CXTPWindowRect@@QAE@PBVCWnd@@@Z) already defined in XTP9601Lib.lib(XTP9601Lib.dll)
XCP9700BetaLibDynStatic.lib(XTPDrawHelpers.obj) : error LNK2005: "public: __thiscall CXTPFontDC::CXTPFontDC(class CDC *,class CFont *)" (
??0CXTPFontDC@@QAE@PAVCDC@@PAVCFont@@@Z) already defined in XTP9601Lib.lib(XTP9601Lib.dll)
XCP9700BetaLibDynStatic.lib(XTPDrawHelpers.obj) : error LNK2005: "public: virtual __thiscall CXTPFontDC::~CXTPFontDC(void)" (
??1CXTPFontDC@@UAE@XZ) already defined in XTP9601Lib.lib(XTP9601Lib.dll)
../Build/Release/PromisProject.exe : fatal error LNK1169: one or more multiply defined symbols found
 
The errors are obvious. But I need to get it to work anyways. How do I supress these errors
or is there any other way so I can use the component with the toolkit???
 
Thanks in advance.
 
Best regards,
Martin
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 18 May 2005 at 9:52am
Try the following, these steps assume Visual Studio 2003, text in BOLD is what you should add:
  1. Make the following changes to the settings in the Properties dialog.  To open the Properties dialog, click on the Project menu, then click on the CalendarControlDemo Properties...  menu item.

    Configuration Properties->C\C++->General->Additional Include Directories:  Add "..\CalendarControl\Source"

    Configuration Properties->C\C++->General->Language->Treat wchar_t as Built: Change to No

    Configuration Properties->Linker->General->Additional Library Directories: Add "..\CalendarControl\lib" and "..\CalendarControl\Source"

    Configuration Properties->Linker->General->Input->Ignore Specific Library: Add "libcd.lib"

    Configuration Properties->Resources->Genaral->Additional Include Directories: Add "..\CalendarControl\Source\Calendar\CalendarControl\res" and "..\CalendarControl\Source"

  2. Add the include file #include <XTCalendarPro.h> for the Calendar Control to the stdafx.h file.  Also, add the #pragma warning(disable:4786) to disable warning message stating that symbols are longer than 255 characters.

    ...

    // turns off MFC's hiding of some common and often safely ignored warning messages
    #define _AFX_ALL_WARNINGS

    // Disable warning stating that symbols contain more than 255 characters.
    #pragma warning(disable:4786)


    #include <afxwin.h> // MFC core and standard components
    #include <afxext.h> // MFC extensions
    #include <afxdisp.h> // MFC Automation classes

    #include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
    #ifndef _AFX_NO_AFXCMN_SUPPORT
    #include <afxcmn.h> // MFC support for Windows Common Controls
    #endif // _AFX_NO_AFXCMN_SUPPORT

    #include <XTCalendarPro.h> // Calendar Control components
  3. Add the following line to the CalendarControlDemo.rc2 file in the \res folder.  Make sure that the correct path is included so that the resource compiler can find the resources needed to build the calendar control.

    //
    // CalendarControlDemo.RC2 - resources Microsoft Visual C++ does not edit directly
    //

    #ifdef APSTUDIO_INVOKED
    #error this file is not editable by Microsoft Visual C++
    #endif //APSTUDIO_INVOKED

    //////////////////////////////////////////////////////////// /////////////////
    // Add manually edited resources here...

    #include "..\CalendarControl\Source\XTCalendarPro.rc"


Edited by SuperMario
Back to Top
Martin View Drop Down
Newbie
Newbie
Avatar

Joined: 26 April 2005
Location: Netherlands
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote Martin Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2005 at 8:53am

Hi,

first of all, thanks for your reply. But I am a bit confused here. I don't want to include the toolkit in the demo calendar application but I have an application which already has the xtreme toolkit included and up and running and now I want to include the calendar control in that application.

This is what I've tried so far:

  • I've copied last XTPDrawHelpers.cpp/ XTPDrawHelpers.h from Calendar Package to ToolkitPro (according to mail from Coleen Stowell)
  • I then rebuilt the library, rebuilt my app, but no luck
  • I then installed the XTP beta version, rebuilt my app, but still no luck
  • I then uninstalled everything CodeJock related and rebooted my system. I then installed the XTP beta kit first, and then the calendar component.
  • Then I rebuilt my whole project once again (is getting pretty tiresome) and still no luck.

I included this line:

#include <XTCalendarPro.h>

after I included this line:

#include <XTToolkitPro.h>

I also tried some of the stuff from your post (but not all since not everything applies to my application being it not the sample application).

Nothing seems to work, I am really at a loss here. Why is it not possible to simply use both kits simultaneously? And why is the calendar component not standard included in the beta toolkit? Then I wouldn't be having this problem in the first place.

I really hope that someone can help me out here.

Thanks in advance.

Best regards,
Martin

Back to Top
Martin View Drop Down
Newbie
Newbie
Avatar

Joined: 26 April 2005
Location: Netherlands
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote Martin Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2005 at 9:15am

One more addition to my previous post.

The errors do not occur the moment I include the calendar component in my stdafx.h file, but when I define a variable in my class for the component as follows:

CXTPCalendarControl m_wndCalendar;

The moment I include this line the linker errors occur.

Cheers,
Martin

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 20 May 2005 at 8:09am

Try to link both statically.

add

#define _XTP_STATICLINK before #include <XTToolkitPro.h>

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Martin View Drop Down
Newbie
Newbie
Avatar

Joined: 26 April 2005
Location: Netherlands
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote Martin Quote  Post ReplyReply Direct Link To This Post Posted: 20 May 2005 at 8:20am

Oleg, thanks for your reply but I already sent you an e-mail explaining that that didn't work as well. In case you didn't get it, here's the mail:

Hi Oleg, Hi Coleen,
 
thanks for your efforts so far.
 
Oleg you're right, when I add this line: #define _XTP_STATICLINK
the linker errors do not occur anymore.
 
However, when I fire up the window that has the component declared the application
crashes. It's only declared in a class, it's not initialized yet and not referenced to in
my source. So it crashes only because of the declaration of the CXTPCalendarControl.
 
I forgot to mention (but I did on the topic on the forum I started) that the problems only
occur (before I added the _XTP_STATICLINK macro) AFTER I declared the above variable
in my class. If I do not do this and just include both the toolkit as the calendar component
the application compiles and links fine. But when I declare the variable again the problems
re-occur.
 
Hope this is useful and thanks a lot for your efforts so far, I hope we can resolve this issue
soon.
 
Looking forward to your response, thanks again.
Back to Top
Martin View Drop Down
Newbie
Newbie
Avatar

Joined: 26 April 2005
Location: Netherlands
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote Martin Quote  Post ReplyReply Direct Link To This Post Posted: 20 May 2005 at 8:37am

And another addition, I just tried to make a new MFC dialog based app, and included the calendar control in the stdafx.h file (nothing more nothing less).

Now when I compile and run it there's no problem, but when I declare a variable for the calendar component it also crashes.

Am I perhaps overlooking something?

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 20 May 2005 at 10:10am

you need to add resource of calendar and toolkitpro.

 

add

#include "XTToolkitPro.rc" and

#include "XTCalendarPro.rc"

 

to your rc2 file.

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Martin View Drop Down
Newbie
Newbie
Avatar

Joined: 26 April 2005
Location: Netherlands
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote Martin Quote  Post ReplyReply Direct Link To This Post Posted: 23 May 2005 at 4:04am

I got it to work!!!!

Thanks a lot, now I only need to do some resizing and repositioning in my dialog but at least the calendar component shows up AND in combination with the Xtreme Toolkit!

Thanks again for all your help guys!

Back to Top
Martin View Drop Down
Newbie
Newbie
Avatar

Joined: 26 April 2005
Location: Netherlands
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote Martin Quote  Post ReplyReply Direct Link To This Post Posted: 23 May 2005 at 4:20am

One small question though, why doesn't this work?

It crashes my app at the following line:

void CXTPCalendarControl::AdjustLayout()
{
   CRect rc;

   GetClientRect(&rc);

   if (!rc.IsRectEmpty())
   {
      m_pActiveView->AdjustLayout(rc, TRUE); // CRASH HAPPENS HERE!
   }
}

My code:

CRect rc;
m_wndPlaceholder.GetWindowRect( &rc );
ScreenToClient( &rc );

if (!m_wndCalendar.Create(WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_BOR DER, rc, this, 333))
return -1;

I need to declare the rectangle as CRect(0, 0, 0, 0) instead of my above approach.

Can anybody shed some light on this issue?

Thanks,
Martin

Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 23 May 2005 at 7:28am
Martin,

Try moving your resizing code to OnSize message handler, like in CCalendarDemoView::OnSize. Does this approach works?

--
WBR,
Serge
Back to Top
Martin View Drop Down
Newbie
Newbie
Avatar

Joined: 26 April 2005
Location: Netherlands
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote Martin Quote  Post ReplyReply Direct Link To This Post Posted: 23 May 2005 at 7:33am

Hi Serge,

yes I already did that as a workaround but I think the above implementation is nicer. Besides I don't understand why the error occurs. It doesn't make sense to me.

But for now it works...

Cheers,
Martin

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.