Picture of iqbal
Registered 5 years 278 days
iqbal Tuesday, 3 September 2019, 11:21 AM
Tutorial: database is returning error
hi there i am new to cpp and heaving problems to excute Innovaphone Database tutorial. i am having these errors as follows:

1.st Error
class NewApp2Session : public AppUpdatesSession {
UTaskTemplate TaskGetHistory;
# Error: C++ The argument list forUTaskTemplate is missing.
void AppWebsocketAccept(class UWebsocket * uwebsocket) { instance->webserverPlugin->WebsocketAccept(uwebsocket); };
char * AppWebsocketPassword() override { return (char *)instance->appPwd(); };
void AppWebsocketMessage(class json_io & msg, word base, const char * mt, const char * src) override;
void AppWebsocketAppInfo(const char * app, class json_io & msg, word base) override;
bool AppWebsocketConnectComplete(class json_io & msg, word info) override;
void AppWebsocketClosed() override;

void TaskGetHistoryProgress(class TaskGetHistory* task, dword progress = 0);
void TaskGetHistoryFinished(class TaskGetHistory* task);

void ResponseSent() override;

void TryClose();

bool closed;
bool closing;
bool admin;
bool adminApp;
class BadgeCountSignaling* badgecount;

public:
NewApp2Session(class NewApp2* instance);
~NewApp2Session();

bool CheckSession();

class NewApp2* instance;
char* currentSrc;
class ITask* currentTask;
void Close();
};

2.st Error
void TaskGetHistory::GetItem(class json_io* json, word base, char*& tmp)
{
json->add_string(base, "sip", dataset->GetStringValue(0));
json->add_ulong64(base, "ts", dataset->GetULong64Value(1), tmp);
json->add_ulong64(base, "count", dataset->GetULong64Value(2), tmp);
}
# Error: C++ The class type is not allowed.
Picture of Daniel Deterding (innovaphone)
Moderator Registered 15 years 178 days
Daniel Deterding (innovaphone) Monday, 9 September 2019, 08:26 AM
Re: Tutorial: database is returning error
You added the member UTaskTemplate TaskGetHistory;

According to the tutorial, you already implemented a class named TaskGetHistory, so you have to name the member taskGetHistory, lowercase.

Greetings,
Daniel
Picture of Hey-Tech
Registered 5 years 199 days
Hey-Tech Thursday, 21 November 2019, 10:55 AM
Re: Tutorial: database is returning error
Greetings,

I am also new to cpp at this level. I am not common with class templates but have some experience in c#.
I did the same tutorial and got to the same error message(s) as james99. But I did write taskGetHistory (!= TaskGetHistory) from the beginning.
I think the use of the template without any arguments is not valid. I got rid of that (first) compiler error by calling the template function like this:

(NewApp1.h)
UTaskTemplate<class NewApp1Session, class TaskGetHistory> taskGetHistory;

But the second one persists

(NewApp1_tasks.cpp - definition of 'void TaskGetHistory::GetItem(class json_io * json, word base, char *& tmp)')
(G1DA8B2) invalid use of incomplete type 'class json_io'
This error is repreated 6 times
that leads me to the conclusion, that the argument list may not be correct.

Is there anyone who did this tutorial and succeeded? Is there any way to call a template function without providing arguments?

Best Regards
Picture of Daniel Deterding (innovaphone)
Moderator Registered 15 years 178 days
Daniel Deterding (innovaphone) Thursday, 21 November 2019, 01:12 PM
Re: Tutorial: database is returning error
incomplete type means that you're missing an include file, in your case it would be:

#include "common/ilib/json.h"

Does it work if you add this line quite at the top of your cpp file near platform/platform.h?

Greetings,
Daniel
Picture of Hey-Tech
Registered 5 years 199 days
Hey-Tech Thursday, 21 November 2019, 02:35 PM
Re: Tutorial: database is returning error
Hi Daniel,

nice to hear from you so quick. I found this one, too and the compiler stops thowing messages. therefore, the linker starts :D Actually i just reinstalled my whole visual studio and inno sdk. There was a lot broken over there and I was missing some header files (whithin platform.cpp - a file that i didnt touch while doing the tutorial). I did not need to address these issues while doing the first tutorial. The linker threw errors about not being able to open some source files but the project compiled and ran anyway.

For the mising include and the missing argument list after UTaskTemplate:
Did I use the template function correctley? If so, the tutorial misses these arguments. I also could not find the missing include anywhere in the tutorial.

Thank you a lot for your quick reply. I'm going to keep you updated.

Best Regards,
Robert
Picture of Daniel Deterding (innovaphone)
Moderator Registered 15 years 178 days
Daniel Deterding (innovaphone) Thursday, 21 November 2019, 04:04 PM
Re: Tutorial: database is returning error
Hi Robert,

you're right, the tutorial was missing the escaping of some characters so that these template arguments were not showing ...
But you did it correctly.

It's fixed now.

Greetings,
Daniel
Picture of Hey-Tech
Registered 5 years 199 days
Hey-Tech Thursday, 21 November 2019, 04:59 PM in response to Hey-Tech
Re: Tutorial: database is returning error
Hey.. This worked like a charm. I freshly installed vs2017 with linux c++ toolkit,
did NOT replace anything inside Linux.Makefile.targets and installed the SDK. I do not have any more problems with intellisense and the linker not being able to locate source files.

I am working on vs2017 15.9.17 and C++ Toolkit 1.0.9.28307. Maybe Microsoft fixed these issues with intellisense in a way that does not get along with your fix.

But next I had a problem with constructors derived from TaskReadWriteCount like MonitorCount, ResetCount etc.. As the tutorial cahnged the constructors signature and the class, which these classes derive from..

That one, I fixed by keeping the original constructor and adding the one from the tutorial.

Now, the whole thing compiles and I get a runtime exception:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000409ae1 in TaskReadWriteCount::WriteCount (this=0x1311760) at NewApp1/NewApp1_tasks.cpp:128
Segmentation fault

this row contains: stmtHistoryInsert->SetParam(0, this->sip);

I guess the instance was constructed without this IPreparedStatment (stmtHistoryInsert is the diference between those 2 constructors.)
Are you sure, that the sample code inside the tutorial is working?

Greetings,
Robert

Picture of Daniel Deterding (innovaphone)
Moderator Registered 15 years 178 days
Daniel Deterding (innovaphone) Friday, 22 November 2019, 09:00 AM
Re: Tutorial: database is returning error
Hi Robert,

I assume you missed this part somehow?

There are several calls of the TaskReadWriteCount constructor (MonitorCount, IncrementCount, ResetCount and CountInit). Pass the stmtHistoryInsert pointer of the NewApp1 instance here (e.g. session->instance->stmtHistoryInsert)

If you handed a nullptr instead of session->instance->stmtHistoryInsert somewhere (that it compiles), it will crash exactly at your line.
I didn't copy all the code parts for this change into the code spoilers ;)

I attached a zip file containing my NewApp1 project with this tutorial which doesn't crash.

Greetings,
Daniel
NewApp1.zip
Picture of Hey-Tech
Registered 5 years 199 days
Hey-Tech Monday, 25 November 2019, 07:19 AM
Re: Tutorial: database is returning error
Hi Daniel,

Oopsie, I guess you are right. Thank you for your kind help on this smile

Greetings, Robert
← You can define your color theme preference here