Hello QuantLib community
I'm compiling my own project using 1.7.1 QuantLib and 1.7 QuantLibAddin, 1.5.8 boost, on Windows 7 32-bit, Visual Studio 2012 I'm getting below error for boost::bind part: bind.hpp(69): error C2825: 'F': must be a class or namespace when followed by '::' bind.hpp(69): error C2039: 'result_type' : is not a member of '`global namespace'' bind.hpp(69): error C2146: syntax error : missing ';' before identifier 'type' bind.hpp(69): error C2208: 'boost::_bi::type' : no members defined using this type bind.hpp(69): fatal error C1903: unable to recover from previous error(s); stopping compilation I'm following the same code in QuantLibXLL: QuantLib::Calendar calendarEnum = ObjectHandler::Create<QuantLib::Calendar>()(calendar); QuantLibAddin::qlCalendarIsBusinessDayBind bindObject = boost::bind((QuantLibAddin::qlCalendarIsBusinessDaySignature) &QuantLib::Calendar::isBusinessDay, calendarEnum, _1); Did I miss anything? Thanks! Regards Jerry ------------------------------------------------------------------------------ Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Hi Jerry,
boost::bind is used for loop functions. This is a function where one of the inputs is defined as a vector, the function executes multiple times, once for each value in the vector. The return value is also a vector, one result for each execution of the function. My first recommendation to you would be to disable looping for this function, and to ensure that the function compiles and executes correctly without looping. Then if you want to enable looping, you would put the following at the top of the function definition: <Procedure name='qlDateIsLeap' loopParameter='Year'> The loop parameter must specify the name of one of the function inputs, and the parameter name must be spelled correctly (it's case sensitive). Then you have to set the loop parameter, and the function return type, to be vector. (This step is handled automatically in the new build :) After that when you re-run gensrc you should get two new pieces of autogenerated code: 1) In file QuantLibAddin/qlo/loop/loop_xxx.hpp, you should get a couple of typedefs relating to boost::bind. 2) In file QuantLibXL/qlxl/functions/xxx.cpp, where the source code for the addin function is found, it should use those typedefs. If you have followed the above steps, and you get some autogenerated source code which does not compile, I am a little surprised, because this feature is old and stable. But maybe you have found a bug in gensrc? Compare the source code of your new looping function to one of the existing ones and try to work out what is different. Maybe there is a missing #include? Try to edit the autogenerated source code manually to get it to compile. Kind Regards, Eric On Wed, 6 Jul 2016 14:45:27 +0800 Jerry Jin <[hidden email]> wrote: > Hello QuantLib community > > I'm compiling my own project using 1.7.1 QuantLib and 1.7 > QuantLibAddin, 1.5.8 boost, on Windows 7 32-bit, Visual Studio 2012 > > I'm getting below error for boost::bind part: > > bind.hpp(69): error C2825: 'F': must be a class or namespace when > followed by '::' > bind.hpp(69): error C2039: 'result_type' : is not a member of > '`global namespace'' > bind.hpp(69): error C2146: syntax error : missing ';' before > identifier 'type' > bind.hpp(69): error C2208: 'boost::_bi::type' : no members defined > using this type > bind.hpp(69): fatal error C1903: unable to recover from previous > error(s); stopping compilation > > I'm following the same code in QuantLibXLL: > > QuantLib::Calendar calendarEnum = > ObjectHandler::Create<QuantLib::Calendar>()(calendar); > > QuantLibAddin::qlCalendarIsBusinessDayBind bindObject = > boost::bind((QuantLibAddin::qlCalendarIsBusinessDaySignature) > &QuantLib::Calendar::isBusinessDay, > calendarEnum, > _1); > > > Did I miss anything? Thanks! > > Regards > Jerry ------------------------------------------------------------------------------ Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Thank you, Eric! The error message was a bit confusing, it points to boost, the code I put in previous mail is working fine, the error was generated from other loop functions, where I missed parameters. I've updated my own source gen logic, now everything compiles fine. Regards Jerry On Thu, Jul 7, 2016 at 5:06 PM, Eric Ehlers <[hidden email]> wrote: Hi Jerry, ------------------------------------------------------------------------------ Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |