visual studio 2010 - c++ Calling class method inside same method -
i´m writing clslog class:
// main dll file. #include "stdafx.h" #include <time.h> #include <fstream> #include <iostream> #include <string> #include "clslog.h" std::string m_strcurloguser; int m_icurlogaction; int m_icurloglevel; std::ofstream m_ocurlogfile; // // loginit // initilize log parameters of system. // filename file name system log messages (log.txt default if no names given). // databasename , tablename specifies database , table name used log. default "log_database" , "log_table" // done. // action shall or options. att: if option giver (ex: database) , invalid name given, error occur. // // default log level 0 (0). every log level upper logged. change level must done // using setloglevel method. // // return = 0: success // 1: failure // int loginit (std::string filename, // initialize log file/connection. std::string databasename, // database name connect to. std::string tablename, // table name connect to. std::string username, // user name log int action) // action done. { // // if file open, calling function before closing previous one. error. // if (m_ocurlogfile.is_open ()) { std::string msg; msg = "loginit called " + filename + " witout closing previous session. error"; this->clslog::log (msg); } // stuff return 0; } // // log // logs message according level. // // return = 0: success // 1: failure // int log (std::string message, int level) // register log according log state. { time_t now; struct tm ptm; char buffer [32]; // // if sent message level below current level, abort. // if (level < m_icurloglevel) return 1; // current date , time , convert time structure (ptm) = time (null); localtime_s (&ptm, &now); // // format time structure: dd/mm/aaaa hh:mm:ss) strftime (buffer, 32, "%d/%m/%y %h:%m:%s", &ptm); // check if needs logged on stdio // if ((m_icurloglevel & logaction_stdout) == logaction_stdout) { cout << buffer + " " + message; } return 0; }
i´m not being able compile. i´m getting following error @
this->clslog::log (msg);
c2227 error on left of '->log' must point class/struct/union/generic type. using vs2010, win32 application.
help appreciated.
rds
i don't see evidence functions inside class definition; therefore, error message says, there's no "this" pointer available. "this" available in instance members of class.
Comments
Post a Comment