ATTENTION

This FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices.


flexsim.com

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
FAQ Downloads Calendar Search Mark Forums Read

Q&A Using Flexsim and building models

Reply
 
Thread Tools Display Modes
  #1  
Old 05-31-2016
Stefan Haeussler
Guest
 
Posts: n/a
Downloads: 0
Uploads: 0
Default C++ and LINGO in Flexsim 7.7 problems

Dear all,

In an earlier project (which was built in Flexsim 4.3) we combined Flexsim with the optimization software LINGO: At the beginning of each period information was sent from Flexsim to LINGO which searched for an optimum and the optimal decision variables were then transferred back to Flexsim.
We did this using a C++ code in a user command which was compiled with Visual Studio.
I tried to do the same for one of my current projects, but came across two difficulties– hopefully someone can help me with that - I am using Flexsim 7.7; Visual Studio Express 2015 (both with admin-rights) and I am using Windows 7 with 64x (Visual Studio Configuration is set to x64):

1. Compiling an empty model works fine with no errors in Flexsim, but if I Open Visual Studio and debug the code it says “unable to start program “C:\Users\mypath\flexsimcontent.dll” the system can't find the file and Visual Studio displays: LNK1120 “76 unresolved externals” and several LNK2019, LNK2001 errors.
- I looked a bit closer to the path where the Flexsimcontent.dll should be and saw that the dll is created but disappears thereafter…
- I tried to follow the solutions provided by the Microsoft homepage but it didn’t help, I tried the following:
o Change the /ZI compiler option.
o RE-install Flexsim (I installed it to C:\Flexsim7.7) and Visual Studio Express

2. I then decided to ignore the error messages from Visual Studio since Flexsim says compiling works fine and wanted to include the Lingo header file (Lingd16.h), but I realized that in Flexsim 7.7 there is no “Global Code” any more and writing “#include “Lingd16.h” at the beginning of my User Command brought up an error saying: “linkage specification must be at global scope”…

Thank you for your suggestions,
Greetings Stefan
Reply With Quote
  #2  
Old 05-31-2016
Phil BoBo's Avatar
Phil BoBo Phil BoBo is offline
Flexsim Development
 
Join Date: Jan 2008
Posts: 756
Downloads: 109
Uploads: 18
Thanks: 385
Thanked 1,483 Times in 525 Posts
Rep Power: 1167
Phil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond repute
Default

Add a node with string data within the Tools folder in the tree, right-click it and select Build > Toggle Node as Global C++, then put your include line within that node's data.
Reply With Quote
The Following 3 Users Say Thank You to Phil BoBo For This Useful Post:
Carsten Seehafer (06-03-2016), Jörg Vogel (06-02-2016), Stefan Haeussler (06-01-2016)
  #3  
Old 06-02-2016
Stefan Haeussler
Guest
 
Posts: n/a
Downloads: 0
Uploads: 0
Lightbulb Update problem

First of all: Thanks PhilBoBo - that solved my second problem.

With regard to the first problem, I think I solved the problem - I need to test it a bit more extensively to be sure...

What I have done to resolve problem 1:
1) In Visual Studio right click on the project: Properties - Configuration Properties - Linker - General - Additional Library Directories: I added the paths: C:\FlexSim7.7\program;C:\FlexSim7.7\program\system \include;C:\FlexSim7.7\program\system\lib;

2) Properties - Configuration Properties - Linker - Input - Additional dependencies: Added flexsim.lib

3) One should also check: Properties - Configuration Properties - VC++ Directories - "Include Directories" and also "Library Directories"

4) Finally, the debugger in Visual Studio was set to "Local Windows Debugger" - I changed that to "Remote Windows Debugger" and set up everything as described in the Wiki Article (https://www.flexsim.com/community/fo...read.php?t=444)

Hopefully the integration of LINGO works as well... ;-)

Greetings,
Stefan
Reply With Quote
The Following User Says Thank You to Stefan Haeussler For This Useful Post:
Carsten Seehafer (06-03-2016)
Reply

Tags
c++ optimization compiler

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with installation Flexsim 5.1 - Error 1904 Sebastian Schreiber Installation 1 02-01-2011 11:21 AM
Problems about tansparency Chunyan Liang Q&A 4 10-17-2010 07:52 AM
4.5 download problems Shankar Narayan Installation 2 03-10-2009 04:25 PM
Problems with wrl file Steven Hamoen Q&A 1 01-25-2008 06:00 AM


All times are GMT -6. The time now is 02:22 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.