Compiling C++ within FlexSim

Compiling C++ within FlexSim

vedant_g1
Not applicable
69 Views
2 Replies
Message 1 of 3

Compiling C++ within FlexSim

vedant_g1
Not applicable

[ FlexSim 18.1.1 ]

12363-howtocompilecplusplus.png

12364-compilerwarning.png

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?

0 Likes
Accepted solutions (1)
70 Views
2 Replies
Replies (2)
Message 2 of 3

jeff_nordgren
Not applicable
Accepted solution
@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.

Message 3 of 3

allister_wilson
Not applicable

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.