cannot access private member in Category

  • edwardt

    edwardt - 2008-07-24

    I am trying to compiles this small code but got the private member access eoor. I am using visual studio 2008. I downloaded the latest version of log4cpp code and has been successful to make a lib and dll for myself. But for my own app, I am scatching my head. Can anyone help?

    Error    1    error C2248: 'log4cpp::Category::Category' : cannot access private member declared in class 'log4cpp::Category'    c:\experiment\simpleconsoleapplication\simpleconsoleapplication\simplehelloworld.cpp    38    SimpleConsoleApplication

    #include <iostream>
    #include <string>
    #include "Category.hh"
    #include "FileAppender.hh"
    #include "BasicLayout.hh"

    int main(int argc, char* argv[])
        int ret = 1;
        std::string dbFileMame = "c:\\temp\\emailAddress.db";
        std::string emailDomain = "c:\\temp\\emailDomain.db";
        std::string emailPart = "c:\\temp\\emailPart.db";
        std::string progressLog = "c:\\temp\\progress.log";

        //Logging exp just play around the api
        log4cpp::Appender* app = new log4cpp::FileAppender("FileAppender",progressLog);
        log4cpp::Layout* layout = new log4cpp::BasicLayout();
        log4cpp::Category main_cat = log4cpp::Category::getInstance("");

    • edwardt

      edwardt - 2008-07-24

      sorry my bad:
      the last line should be log4cpp::Category& main_cat = log4cpp::Category::getInstance("");

      a reference because of a private copy constructor


Log in to post a comment.