question

Vedant G avatar image
0 Likes"
Vedant G asked Allister Wilson edited

Compiling C++ within FlexSim

How do you compile C++ code within FlexSim

I am trying to compile this code inside a Custom Code activity, it keeps asking me if I want to proceed without compiling it, the question is, how do I compile it?

FlexSim 18.1.1
c++
5 |100000

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

Jeff Nordgren avatar image
2 Likes"
Jeff Nordgren answered
@Vedant G

Not sure why you are trying to enter C++ code directly into FlexSim. I'm pretty sure that you can use FlexSim's FlexScript (patterned after C++) to accomplish pretty much anything you need to do. If not, it may be better to create a .dll in C++ and link it to FlexSim.

I would suggest that you read the Reference>Coding in FlexSim area of the User Manual to better understand how to "code" within FlexSim.

Thanks.

5 |100000

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

Allister Wilson avatar image
2 Likes"
Allister Wilson answered Allister Wilson edited

You can compile using the options in the Build menu.

However, that code definitely won't compile.

Each node in the tree which contains code is treated as a single function, so you're trying to declare a function within another.

As Jeff said though, I wouldn't advise using C++ inside FlexSim models unless you actually need to for some reason (and even then, a DLL will likely be a better option), FlexScript can do pretty much everything you may need, is usually fast enough by a comfortable margin, and doesn't need to be compiled explicitly.

5 |100000

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