c++ - error C2039: 'get_quest_dynstr' : is not a member of '`global namespace' -
i error
error 2 error c2039: 'get_quest_dynstr' : not member of '`global namespace'' e:\phase3a\tdisk\workspace\cbs\source\cbs\schedapp\source\treesearchbox.cpp 17 1 schedapp
error 3 error c2039: 'checkcommand' : not member of '`global namespace'' e:\phase3a\tdisk\workspace\cbs\source\cbs\schedapp\source\treesearchbox.cpp 21 1 schedapp
when try compile c++ application.
treesearchbox.hpp
#if !defined(tree_search_box) #define tree_search_box #include "standaloneconn.hpp" class tree_search_box : public standalone_conn { public: tree_search_box(); virtual int get_quest_dynstr(int idquest, lptstr opstr, pdynobj dynpobj); virtual int checkcommand(pbasewnd pwnd, int iditem, hwnd hwndctl, int wnotifycode, int indx); virtual lptstr get_classname(){return _text("tree_search_box");} }; #endif
treesearchbox.cpp
#include "cpptot.hpp" #include "apptot.hpp" #include "treesearchbox.hpp" #include "lov.hpp" //****************************************************************************** // component: ifs/scheduling // // file name: treesearchbox.cpp // // purpose: contains object connecting standalone client directly oracle // // ver date sign history // --- ---- ---- ------- // 150604 farflk adding tree search functioanlity enhanced //****************************************************************************** int tree_search_box::get_quest_dynstr(int idquest, lptstr opstr, pdynobj dynpobj){ return 0;//get_quest_dynstr(idquest, opstr, dynpobj); } int tree_search_box::checkcommand(pbasewnd pwnd, int iditem, hwnd hwndctl, int wnotifycode, int indx){ return 0; }
i'm struggling long time on how rectify error. please me. doing wrong?
in beginning have guard block:
#if !defined(tree_search_box) #define tree_search_box
which good. mean call #define tree_search_box
means tree_search_box
defined nothing. when compile, preprocessor scans files, , replaces tree_search_box
. breaking code, because you're trying compile this:
int ::get_quest_dynstr(int idquest, lptstr opstr, pdynobj dynpobj){ ...
where :: means global namespace
.
there 2 ways fix this:
change guard block
#if !defined(tree_search_box_something_else) #define tree_search_box_something_else
change class name.
what find interesting don't errors fact try compile:
class : public standalone_conn{
but turns out can define anonymous class this:
class : baseclass { //bla };
i guess learned today :)
Comments
Post a Comment