question

Hao Zhou avatar image
0 Likes"
Hao Zhou asked Mischa Spelt commented

ObjectDataType FlexScript interface functions cannot be compiled in SDK

For example, I am trying to replace deprecated command setloc() with setLocation() in my module. I have a class that inherits from FlexSimObject. In one of its member functions, I am trying to call

this->setLocation(0.0, 0.0, 0.0);

But the compiler shows error:

error LNK2019: unresolved external symbol

How to fix this problem? Engine version is 17.1 beta.

BTW, just notice that not only this function, all other ObjectDataType functions or properties such as getLocation(), setSize(), location, rotation, etc. cannot be compiled properly if I call them in my module.

Thanks, Hao

FlexSim (other - please specify)
FlexSim (other)
module sdk
· 10
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jordan Johnson avatar image Jordan Johnson ♦♦ commented ·

This looks like a problem with the 32 bit libs. We'll look in to this issue. I didn't have a problem building in 64 bit.

0 Likes 0 ·
Hao Zhou avatar image Hao Zhou Jordan Johnson ♦♦ commented ·

I am also using 64 bit version. I checked my project setting, it links to 64 libs (flexsimcontent.lib and flexsim.lib) properly.

0 Likes 0 ·
Hao Zhou avatar image Hao Zhou Jordan Johnson ♦♦ commented ·

Hi Jordan, @jordan.johnson

I created a brand new module with latest module SDK wizard. I put sample class Snowflake and SnowProcessor into the module. The code is attached test.zip

I tried to call the following code in the end of SnowProcessor::onReset()

this->setLocation(0.0, 0.0, 0.0);

When I compile it in X64 mode, it gives me error as follows:

SnowProcessor.obj : error LNK2019: unresolved external symbol "public: class FlexSim::ObjectDataType & __cdecl FlexSim::ObjectDataType::setLocation(double,double,double)" (?setLocation@ObjectDataType@FlexSim@@QEAAAEAV12@NNN@Z) referenced in function "public: virtual double __cdecl SnowProcessor::onReset(void)" (?onReset@SnowProcessor@@UEAANXZ)

Could you help me to figure out the problem? Really appreciate it.

BTW, report an error in SDK document as follows:

I guess it should be changed to

if (strcmp(classname, "SnowProcessor") == 0) return new SnowProcessor;

Thanks, Hao

0 Likes 0 ·
1.png (18.5 KiB)
test.zip (2.7 KiB)
Hao Zhou avatar image Hao Zhou commented ·

Hi @jordan.johnson

The SDK is actually still not working. See attached file for reference. test.zip

I did the same thing as before, I called the following code in the end of SnowProcessor::onReset()

this->setLocation(0.0, 0.0, 0.0);

In the end of SnowProcessor.cpp, I created a function as follows:

visible void test_nodefunction(FLEXSIMINTERFACE)
{
	pt("test");
	pr();
}

And this function is called whenever a new model is created, see attached image

Then, when I open FlexSim and create a new model, it give me erros as follows. That means module dll is not connected properly.

exception: Dll Error : could not connect to exported dll function for MAIN:/project/events/OnNewModel/test.
Windows Error Code: 126

However, when I delete the line "this->setLocation(0.0, 0.0, 0.0);", and rebuild module (Note: you have to rebuild), the dll does not have any problems.

Could you help to figure out the problem? Engine version is 17.1 beta.

Thanks, Hao

0 Likes 0 ·
1.png (23.0 KiB)
test.zip (302.1 KiB)
Jordan Johnson avatar image Jordan Johnson ♦♦ Hao Zhou commented ·

I'm working on this, but there is something strange going on. It will take a little time to figure out.

0 Likes 0 ·
Hao Zhou avatar image Hao Zhou Jordan Johnson ♦♦ commented ·

Thanks for the reply. Looking forward it gets fixed.

0 Likes 0 ·
Show more comments
Hao Zhou avatar image Hao Zhou Hao Zhou commented ·

Hi Jordan,

Thanks for the reply. I cannot figure out how to reply to your comments directly, so I would post a new answer.

I had this problem because at that time I used a beta version of FlexSim. And I got headers and libs from SDK repository and put them into my module. Somehow, them are not match with each other. Later, when I upgraded to 17.1.1. I built a set of headers and libs from installed software directly. Then I tried that again. I found the problem is resolved.

Thanks for your help!

0 Likes 0 ·
Jacob Gillespie avatar image Jacob Gillespie ♦ Hao Zhou commented ·

@Hao Zhou It's a bit inconsistent how you reply to things.

To reply to an answer click Add comment.

To reply to a comment, hover over the comment with your mouse which makes a reply button appear. Click Reply.

1 Like 1 ·
replyanswer.png (15.5 KiB)
commentreply.png (12.0 KiB)
Show more comments

1 Answer

·
Jordan Johnson avatar image
1 Like"
Jordan Johnson answered Mischa Spelt commented

I updated the header files and libs in the module SDK. The new headers and libs should allow you to use the setLocation() method. I had forgotten to mark those functions to be accessible (with the engine_export macro).

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Mischa Spelt avatar image Mischa Spelt commented ·

Hi jordan. On which branches will this impact module development? I hope we don't have to compile against yet another flexsimcontent for 17.0.6? :-)

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.