{"id":844,"date":"2022-08-30T15:08:07","date_gmt":"2022-08-30T15:08:07","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/compiler-error-identifier-undefined-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:08:07","modified_gmt":"2022-08-30T15:08:07","slug":"compiler-error-identifier-undefined-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/compiler-error-identifier-undefined-collection-of-common-programming-errors\/","title":{"rendered":"Compiler Error &#8211; Identifier undefined-Collection of common programming errors"},"content":{"rendered":"<p>I have a fairly simple C++ code that doesn&#8217;t seem to be compiling properly. Essentially, I have some globally defined functions declared in my GLOBAL.HPP file, and are defined in my GLOBAL.CPP file. Then I have a class, EuroOption, that consists of a struct datamember. The class EuroOption has its own member functions that essentially do the same exact thing that the global functions do&#8211;so I defined them similarly, and just called global functions inside of the EuroOption member function definitions. Please see below:<\/p>\n<pre><code>\/\/\n\/\/GLOBAL.HPP\n\/\/\n\n#ifndef GLOBAL_HPP\n#define GLOBAL_HPP\n\n#include \n#include \n#include \n#include  \/\/ For non-member functions of distributions\n\nusing namespace std;\n\/\/using namespace boost::math;\n\n\nnamespace GLOBAL \/\/ Encapsulate Point in the Global namespace\n{\n\n\nstruct EuroOptionData\n{\n    double r;       \/\/ Interest rate\n    double sig;     \/\/ Volatility\n    double K;       \/\/ Strike price\n    double T;       \/\/ Expiry date\n    double b;       \/\/ Cost of carry\n};\n\ndouble n(double x);\ndouble N(double x);\ndouble CallPrice(EuroOptionData od, double S);\ndouble PutPrice(EuroOptionData od, double S);\ndouble PutParity(EuroOptionData od, double S);\ndouble CallParity (EuroOptionData od, double S);\n\n\n} \/\/ Close namespace GLOBAL\n\n#endif\n<\/code><\/pre>\n<p>Here is the EuroOption.HPP file:<\/p>\n<pre><code>\/\/\n\/\/\n\/\/\n\n#ifndef EUROOPTION_HPP\n#define EUROOPTION_HPP\n\n\n#include \n#include \"Global.hpp\"\n\nusing namespace std;\nusing namespace GLOBAL;\n\nclass EuroOption\n{\nprivate:        \n\npublic:\n    struct EuroOptionData od;\n\n\n    \/\/EuroOption class functions\n    EuroOption();                               \/\/ Default     call option\n    EuroOption(const EuroOption&amp; option2);      \/\/ Copy constructor\n    virtual ~EuroOption();                      \/\/Destructor\n\n    \/\/EuroOption Global Function Calls\n    double EuroCallPrice(EuroOptionData od, double S);\n    double EuroPutPrice(EuroOptionData od, double S);\n    double EuroCallParity(EuroOptionData od, double S);\n    double EuroPutParity(EuroOptionData od, double S);\n\n    \/\/EuroOption class operators\n    EuroOption&amp; operator = (const EuroOption&amp; option2); \/\/Assignment Operator\n\n };\n\n#endif\n<\/code><\/pre>\n<p>And a snippet of the EuroOption.CPP file:<\/p>\n<pre><code>\/\/\n\/\/\n\/\/\n\n#include \"EuroOption.hpp\"\n#include \n#include \n\nusing namespace GLOBAL;\n{\n\ndouble EuroOption::EuroCallPrice(EuroOptionData od, double S)\n{\n    return CallPrice(od,S);\n};\n\ndouble EuroOption::EuroPutPrice(EuroOptionData od, double S)\n{\n    return CallPrice(od,S);\n};\n\n.....\n...\n}\n<\/code><\/pre>\n<p>And finally, a snippet of my Test.CPP file where I test functionality:<\/p>\n<pre><code>\/\/\n\/\/\n\/\/\n\n#include \"Global.hpp\"\n#include \"EuroOption.hpp\"\n#include \n\nusing namespace GLOBAL;\n\nint main()\n{\nEuroOption Batch1;      \/\/Initialize EuroOption class object Batch1\n\n    cout &gt; S1;\n    cout<\/code><\/pre>\n<p id=\"rop\"><small>Originally posted 2013-11-09 22:48:31. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I have a fairly simple C++ code that doesn&#8217;t seem to be compiling properly. Essentially, I have some globally defined functions declared in my GLOBAL.HPP file, and are defined in my GLOBAL.CPP file. Then I have a class, EuroOption, that consists of a struct datamember. The class EuroOption has its own member functions that essentially [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-844","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/844","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=844"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/844\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=844"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=844"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=844"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}