Hi all,
i'm a new user and i'm trying to insert and compile a new class in quantlib. I apologize for this newbie question: if i compile my class all work well but if i insert it in quantlib, visual studio can't build the library giving me the following error: 1>d:\Quantlib\QuantLib-0.9.0\ql/indexes/inflationindexseasonality.hpp(52) : fatal error C1004: unexpected end-of-file found 1>inflationindex.cpp 1>d:\Quantlib\QuantLib-0.9.0\ql/indexes/inflationindexseasonality.hpp(52) : fatal error C1004: unexpected end-of-file found If i delete the following rows: #ifndef SEASONALITY_HPP (12) #define SEASONALITY_HPP (12) #endif (52) visual studio can compile and i'm able to use my class. I can't find the reason of this error; anyone has any ideas? Thank you very much for help. Bye Piero //File name: inflationindexseasonality.cpp // //Author: Piero Del Boca // //Last changes: 14/02/2007 // #include <ql/indexes/inflationindexseasonality.hpp> #include <ql/errors.hpp> namespace QuantLib { Seasonality::Seasonality() { int dim = 12; //12 is the number of months in 1 year seasonalityFactors = new Rate[dim]; for (int i=0; i<dim; i++) {seasonalityFactors[i] = 1.;} } Seasonality::Seasonality(Rate *seasonalityFactorsInit, Month baseMonthInit, bool normalized) { int dim = 12; //12 is the number of months in 1 year seasonalityFactors = new Rate[dim]; for (int i=0; i<dim; i++) { seasonalityFactors[i] = seasonalityFactorsInit[i]; } SetBaseMonth(baseMonthInit); if (!normalized) { for (int i=0; i<dim; i++) { seasonalityFactors[i] /= seasonalityFactorsInit[baseMonth-1]; } } else{ QL_REQUIRE(seasonalityFactors[baseMonth-1] == 1., "Base month seasonality factor is different from 1; " "if your seasonality factors aren't normalized pls insert " "normalized = false"); } } Seasonality::~Seasonality() { delete[] seasonalityFactors; } void Seasonality::SetSeasonalityFactor(Month monthInit, Rate seasonalityFactorInit) { seasonalityFactors[monthInit-1] = seasonalityFactorInit; } void Seasonality::SetBaseMonth(Month baseMonthInit) { baseMonth = baseMonthInit; } Rate Seasonality::GetSeasonalityFactor(Month monthInit) const { return seasonalityFactors[monthInit-1]; } Month Seasonality::GetBaseMonth() const { return baseMonth; } } //File name: inflationindexseasonality.hpp // //Author: Piero Del Boca // //Last changes: 14/02/2007 // //Description: this class contains normalized seasonality factors and base CPI month; // in the base CPI month (called baseMonth) seasonality factor must be = 1; // this class is built for a MOLTIPLICATIVE seasonality correction. // #ifndef SEASONALITY_HPP #define SEASONALITY_HPP #include <ql/time/date.hpp> namespace QuantLib { class Seasonality { private : Rate *seasonalityFactors; Month baseMonth; public : //Constructor // Seasonality(); //It sets seasonality factors = 1 Seasonality(Rate *seasonalityFactorsInit, //Insert seasonality factors starting from January Month baseMonthInit, bool normalized); //Set true if seasonality factors are normalized //Destructor // ~Seasonality(); //Functions // void SetBaseMonth(Month baseMonthInit); void SetSeasonalityFactor(Month monthInit, Rate seasonalityFactorInit); Rate GetSeasonalityFactor(Month monthInit) const; Month GetBaseMonth() const; }; } #endif ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Hi Piero,
Try inserting a hard return after the #endif statement (hit the enter key). Toyin Akin. > Date: Fri, 15 Feb 2008 11:11:49 +0100 > From: [hidden email] > To: [hidden email] > Subject: [Quantlib-users] inserting new class in quantlib > > Hi all, > i'm a new user and i'm trying to insert and compile a new class in > quantlib. > I apologize for this newbie question: > > if i compile my class all work well but if i insert it in quantlib, > visual studio can't build the library giving me the following error: > > 1>d:\Quantlib\QuantLib-0.9.0\ql/indexes/inflationindexseasonality.hpp(52) > : fatal error C1004: unexpected end-of-file found > 1>inflationindex.cpp > 1>d:\Quantlib\QuantLib-0.9.0\ql/indexes/inflationindexseasonality.hpp(52) > : fatal error C1004: unexpected end-of-file found > > If i delete the following rows: > > #ifndef SEASONALITY_HPP (12) > #define SEASONALITY_HPP (12) > #endif (52) > > visual studio can compile and i'm able to use my class. > I can't find the reason of this error; anyone has any ideas? > > Thank you very much for help. > Bye > > Piero > Sounds like? How many syllables? Guess and win prizes with Search Charades! ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Toyin Akin ha scritto:
> Hi Piero, > > Try inserting a hard return after the #endif statement (hit the enter > key). > > Toyin Akin. > > > > > > ------------------------------------------------------------------------ > > > Date: Fri, 15 Feb 2008 11:11:49 +0100 > > From: [hidden email] > > To: [hidden email] > > Subject: [Quantlib-users] inserting new class in quantlib > > > > Hi all, > > i'm a new user and i'm trying to insert and compile a new class in > > quantlib. > > I apologize for this newbie question: > > > > if i compile my class all work well but if i insert it in quantlib, > > visual studio can't build the library giving me the following error: > > > > > 1>d:\Quantlib\QuantLib-0.9.0\ql/indexes/inflationindexseasonality.hpp(52) > > : fatal error C1004: unexpected end-of-file found > > 1>inflationindex.cpp > > > 1>d:\Quantlib\QuantLib-0.9.0\ql/indexes/inflationindexseasonality.hpp(52) > > : fatal error C1004: unexpected end-of-file found > > > > If i delete the following rows: > > > > #ifndef SEASONALITY_HPP (12) > > #define SEASONALITY_HPP (12) > > #endif (52) > > > > visual studio can compile and i'm able to use my class. > > I can't find the reason of this error; anyone has any ideas? > > > > Thank you very much for help. > > Bye > > > > Piero > > > > > ------------------------------------------------------------------------ > Sounds like? How many syllables? Guess and win prizes with Search > Charades! <http://www.searchcharades.com> > > __________ Informazione NOD32 2880 (20080215) __________ > > Questo messaggio è stato controllato dal Sistema Antivirus NOD32 > http://www.nod32.it ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
In reply to this post by Toyin Akin
Wow now it works!!!thank you very much for help...
bye Piero Toyin Akin ha scritto: > Hi Piero, > > Try inserting a hard return after the #endif statement (hit the enter > key). > > Toyin Akin. > > > > > > ------------------------------------------------------------------------ > > > Date: Fri, 15 Feb 2008 11:11:49 +0100 > > From: [hidden email] > > To: [hidden email] > > Subject: [Quantlib-users] inserting new class in quantlib > > > > Hi all, > > i'm a new user and i'm trying to insert and compile a new class in > > quantlib. > > I apologize for this newbie question: > > > > if i compile my class all work well but if i insert it in quantlib, > > visual studio can't build the library giving me the following error: > > > > > 1>d:\Quantlib\QuantLib-0.9.0\ql/indexes/inflationindexseasonality.hpp(52) > > : fatal error C1004: unexpected end-of-file found > > 1>inflationindex.cpp > > > 1>d:\Quantlib\QuantLib-0.9.0\ql/indexes/inflationindexseasonality.hpp(52) > > : fatal error C1004: unexpected end-of-file found > > > > If i delete the following rows: > > > > #ifndef SEASONALITY_HPP (12) > > #define SEASONALITY_HPP (12) > > #endif (52) > > > > visual studio can compile and i'm able to use my class. > > I can't find the reason of this error; anyone has any ideas? > > > > Thank you very much for help. > > Bye > > > > Piero > > > > > ------------------------------------------------------------------------ > Sounds like? How many syllables? Guess and win prizes with Search > Charades! <http://www.searchcharades.com> > > __________ Informazione NOD32 2880 (20080215) __________ > > Questo messaggio è stato controllato dal Sistema Antivirus NOD32 > http://www.nod32.it ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |