build issue on Qt/C++ -


this question has answer here:

i'm having build issue in 1 on class. dev done in qt/c++

header.h

class ui_dialogboxprogress : public qdialog {     q_object  public:     explicit ui_dialogboxprogress(qwidget *parent = 0, cache& cache);     ~ui_dialogboxprogress();     cache& m_cache; 

src.cpp

ui_dialogboxprogress::ui_dialogboxprogress(qwidget *parent, cache& cache) :     qdialog(parent),     m_cache(cache),     ui(new ui::ui_dialogboxprogress) {     ui->setupui(this);     ... 

currently error :

header.h:21: error: missing default argument on parameter 'cache'     explicit ui_dialogboxprogress(qwidget *parent = 0, cache& cache); 

and call done in main.cpp below :

deleteprogress = new ui_dialogboxprogress(*this, *cache);                                                           ^ 

cache class defined below:

class cache { public:     cache(); .. 

any idea ? use kind of method build never complain

once define default value function argument, every argument thereafter needs default argument well. c++ rule, not qt. difficult in case because you're taking second argument non-const reference. can switch order of function arguments, or require refactoring lot of code? can take cache pointer instead of reference; can set default argument of nullptr argument.

this thread has decent solution might want take at.


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -