variable in this class does not name a type C++
<p>I am trying to use log4cpp in my program (*nix machine - Ubuntu 12.10, Codeblocks) to create logs at various instances in the program.</p>

<p><strong>LoggerMain.h</strong></p>

<pre><code>#include "log4cpp/Category.hh"
#include "log4cpp/Appender.hh"
#include "log4cpp/FileAppender.hh"
#include "log4cpp/OstreamAppender.hh"
#include "log4cpp/Layout.hh"
#include "log4cpp/BasicLayout.hh"
#include "log4cpp/Priority.hh"
</code></pre>

<p><strong>MainProgram.h</strong></p>

<pre><code>#include "LoggerMain.h"

MainProgram{
public:
log4cpp::Appender *appender;
};
</code></pre>

<p><strong>MainProgram.cpp</strong></p>

<pre><code>appender = new log4cpp::FileAppender("default","program.log"); //getting error here
appender-&gt;setLayout(new log4cpp::BasicLayout());
log4cpp::Category&amp; root = log4cpp::Category::getRoot();

main{
//will use root here for loggin
}
</code></pre>

<p>Error:
<strong>src/MainProgram.cpp|21|error: ‘appender’ in ‘class MainProgram’ does not name a type|</strong></p>

<p>What's going wrong? I am basically doing the same thing as in the log4cpp simple example documentation <a href="http://log4cpp.sourceforge.net/#simpleexample" rel="nofollow">here</a></p>
