Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: calculus on February 07, 2011, 04:22:01 pm

Title: CodeBlocks newby question
Post by: calculus on February 07, 2011, 04:22:01 pm
Hi there,

I have found some sample code on the internet and was playing around with it in order to understand what it does. The code is for the class is:

#ifndef EUROPEANOPTION_H_INCLUDED
#define EUROPEANOPTION_H_INCLUDED

#include <string>

class EuropeanOption
{
private:

   void init();   // Initialise all default values
   void copy(const EuropeanOption& o2);

   // 'Kernel' functions for option calculations
   double CallPrice() const;
   double PutPrice() const;
   double CallDelta() const;
   double PutDelta() const;


public:
   // Public member data for convenience only
   double r;      // Interest rate
   double sig;      // Volatility
   double K;      // Strike price
   double T;      // Expiry date
   double U;      // Current underlying price
   double b;      // Cost of carry

   string optType;   // Option name (call, put)

};


However, I am getting the following error on the line in bold: 'string' does not use name type.

Am I calling the <string> class incorrectly? Also how does CodeBlocks add classes like string and math.h? Do I have to install them or are they already in the compiler?
Title: Re: CodeBlocks newby question
Post by: Jenna on February 07, 2011, 04:27:15 pm
string and math.h are not classes, but header-files and can be provided by the compiler or not, depends on your compiler and version.
C::B isnot a compiler, but an IntegratedDevelopmentEnvironment.
You seem to miss the absolute basics of programming.
You should try to find a website/forum, that supports basic programming questions or (better) buy yourself a good book about programming.

This forum/site is not such a site and your question is violating our forum rules therfore.

If you have questions related to C::B or how to set special parameters in C::B, feel free to start a new topic.

Topic locked !
Title: Re: CodeBlocks newby question
Post by: stahta01 on February 07, 2011, 05:12:04 pm
Turn on Full Compiler Logging and find a programing site like http://cboard.cprogramming.com/ to help you.

http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

Tim S.