'beginOffset' : member function not declared in 'MyTaskExecuter' -mudule sdk

'beginOffset' : member function not declared in 'MyTaskExecuter' -mudule sdk

frenk_gao
Not applicable
164 Views
4 Replies
Message 1 of 5

'beginOffset' : member function not declared in 'MyTaskExecuter' -mudule sdk

frenk_gao
Not applicable

[ FlexSim 16.0.9 ]

I am trying to Implementing Module DLLs (SDK-Documentation-ModuleDevelopment).

But there is always throw a error when I try to build my module dll (testmodel.dll in the Documentation) :

Error  1  error C2509: 'beginOffset' : member
function not declared in 'MyTaskExecuter'  \testmodule\mytaskexecuter.cpp  9  1  testmodule

And the source code:

_______________________

MyTaskExecuter.cpp

#include "MyTaskExecuter.h"
void MyTaskExecuter::bindVariables()
{
    TaskExecuter::bindVariables();
}
double MyTaskExecuter::beginOffset(double endspeed, treenode item)
{
    offsetloc[1] = 0;
    offsetloc[2] = 0;
    return beginOffsetDefault(endspeed, item);
}

_____________________________

MyTaskExecuter.h

#pragma once
#include "FlexsimDefs.h"
class MyTaskExecuter : public TaskExecuter
{
	virtual void bindVariables() override;
};

_____________________

testmodule.cpp

#include "testmodule.h"


visible ObjectDataType* createodtderivative(char* classname)
{
	if (strcmp(classname, "MyTaskExecuter") == 0) return new MyTaskExecuter;
	return NULL;
}


visible SimpleDataType* createsdtderivative(char* classname)
{
	return NULL;
}


visible void dllinitialize()
{


}


visible void dllcleanup()
{


}

testmodule.h

#pragma once

#include "FlexsimDefs.h"
#include "allobjects.h"

class MyTaskExecuter : public TaskExecuter
{
public:
	virtual void bindVariables(void);
	virtual double beginOffset(double endspeed, treenode item);
};
0 Likes
Accepted solutions (1)
165 Views
4 Replies
Replies (4)
Message 2 of 5

SCHamoen
Advisor
Advisor
Accepted solution

@Frenk Gao You have declared your class twice (in your .h file and in testmodule.cpp) it should not be in testmodule only in .h But in your class declaration you should also include the begin offset like in the testmodule.cpp.

The reason you get the error is that the compiler tries to compile MyTaskexecuter.cpp and the only extra information it has it MyTaskexecuter.h because that is what you include. But in the .h file the beginoffset is not declared so that is exactly the error you get.

Message 3 of 5

frenk_gao
Not applicable

Thank you!

When delete the testmodule.h 's code, it looks ok.

And also I should insert

#include "MyTaskExecuter.h"

in the testmodeule.cpp to include MyTaskExecuter Class.

But the Documentation do not tell me to do it. It's not friendly to a C++ rookie.

0 Likes
Message 4 of 5

SCHamoen
Advisor
Advisor

@Frenk Gao May I suggest www.cplusplus.com for more information about C++

0 Likes
Message 5 of 5

frenk_gao1
Not applicable

You are so nice!

Thank you for your suggestion!

0 Likes