problem to compile template with borland C++ 5.6

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

problem to compile template with borland C++ 5.6

Xavier.Abulker
Hello
 I have a problem to compile Quantlib templates with Borland Builder 6.
My example is the simple following:

       Calendar calendar = TARGET();
        QuantLib::Currency currency = EUR;
        int settlementDays = 2;

        /*********************
         ***  MARKET DATA  ***
         *********************/

        QuantLib::Date todaysDate(19, October, 2001);
        double d2dquote=Edit1->Text.ToDouble();
        QuantLib::DayCounter depositDayCounter = Actual360();
        double d1yQuote=0.03;

then this call:

Handle<RateHelper> d1y(new DepositRateHelper(
            d1yQuote, 2,
            1, Years, calendar, ModifiedFollowing, depositDayCounter));

gives me the error:

[C++ Error] Unit1.cpp(51): E2108 Improper use of typedef 'RateHelper'

this call

QuantLib::Handle<RateHelper> d1y(new DepositRateHelper(
            d1yQuote, 2,
            1, Years, calendar, ModifiedFollowing, depositDayCounter));


It compiles well but when I launch it there is a crash with an error:
 "raised exception class EAccess Violation"

Thanks in advance for your help.
Xavier


*************************************************************************
Ce message et toutes les pieces jointes (ci-apres le "message") sont
confidentiels et etablis a l'intention exclusive de ses destinataires.
Toute utilisation ou diffusion non autorisee est interdite.
Tout message electronique est susceptible d'alteration.
La FIMAT et ses filiales declinent toute responsabilite au
titre de ce message s'il a ete altere, deforme ou falsifie.
                    ********
This message and any attachments (the "message") are confidential and
intended solely for the addressees.
Any unauthorised use or dissemination is prohibited.
E-mails are susceptible to alteration.
Neither FIMAT nor any of its subsidiaries or affiliates shall
be liable for the message if altered, changed or falsified.
*************************************************************************



Reply | Threaded
Open this post in threaded view
|

Re: problem to compile template with borland C++ 5.6

Luigi Ballabio-2
At 02:57 PM 9/10/02 +0200, [hidden email] wrote:

>then this call:
>
>Handle<RateHelper> d1y(new DepositRateHelper(
>             d1yQuote, 2,
>             1, Years, calendar, ModifiedFollowing, depositDayCounter));
>
>gives me the error:
>
>[C++ Error] Unit1.cpp(51): E2108 Improper use of typedef 'RateHelper'
>
>this call
>
>QuantLib::Handle<RateHelper> d1y(new DepositRateHelper(
>             d1yQuote, 2,
>             1, Years, calendar, ModifiedFollowing, depositDayCounter));
>
>
>It compiles well but when I launch it there is a crash with an error:
>  "raised exception class EAccess Violation"

Hmm. Hard to say without seeing the rest of the code.

First of all, I assume you are including "ql/quantlib.hpp", so that rate
helpers are included as well. Now, the declaration above with all types
fully specified should read:

QuantLib::Handle<QuantLib::TermStructures::RateHelper> d1y(
     new QuantLib::TermStructures::DepositRateHelper(
        d1yQuote, 2,
        1, QuantLib::Years, calendar, QuantLib::ModifiedFollowing,
        depositDayCounter));

You might remove some of the namespace specifications using "using"
directives such as

using QuantLib::TermStructures::RateHelper;

the same applies to Calendar, TARGET, and any other QuantLib class.
In short, make sure that the compiler knows in which namespace to find each
class. If that doesn't help, I'll try to think of something else...

Later,
         Luigi