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 > Wiki Articles
FAQ Downloads Calendar Search Mark Forums Read

Wiki Articles Instructional documents authored collectively by the Flexsim community

Reply
 
Thread Tools Display Modes
  #1  
Old 05-01-2008
Anthony Johnson's Avatar
Anthony Johnson Anthony Johnson is offline
Manager of Product Development
 
Join Date: Jul 2007
Posts: 440
Downloads: 86
Uploads: 4
Thanks: 171
Thanked 899 Times in 288 Posts
Rep Power: 732
Anthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond repute
Default How to set up C++ debugging in Visual Studio

This article explains how to set up C++ debugging for Flexsim using Visual Studio. You will only be able to debug code that is toggled as C++, not flexscript.

NOTE: If you are using Flexsim version 5 or greater, follow these steps:
  1. Go to the Flexsim main menu option File > Global Preferences, then on the Compiler tab check the Enable Debugging box and press Apply.
  2. From within Flexsim, load your model. Next you will need to compile your model, but the type of compile depends on what parts of your model you want to debug. If you are just interested in debugging your C++ model code that you entered in triggers, then a regular compile will work (Flexsim main menu option Build > Compile Model F7). If you want to debug library code, i.e. the functionality of the standard Flexsim library, as well as the C++ implementations of the command list, then you will need to compile the entire session (Build > Compile Entire Session).
  3. Open Visual Studio from Flexsim (Build > Open Visual Studio...). Go to the Visual Studio menu option Tools > Attach to Process... and select flexsim.exe. (The Flexsim content compiles to flexsimcontent.dll instead of switching between flexsimRTa.exe and flexsimRTb.exe, so you only need to attach to the flexsim.exe and you don't need to worry about the changing executable file.)
  4. After you set the debug options, (for example, a break point at one of your code lines), switch back to Flexsim and click Run. When Flexsim runs into the break point, it will automatically switch to Visual Studio. You can then step through your code and view variable values in Visual Studio.

If you are using a version of Flexsim before version 5, the steps are more complicated:
  1. Make sure that Flexsim is closed. Go to the install folder of Flexsim and go to the program/config folder. In that folder there are 3 files that need to be edited. The first one is flexsimexeB.txt. You need to add the “/DEBUG” in the line after /nologo so that the line looks like this:

    /link /nologo /DEBUG /subsystem:windows /machine:I386 /OUT:"..\..\

    The other two files are allobj.txt and allobjectsobj.txt. In both of these files you need to add “/Zi” after the /MT so that the line looks like this:

    cl /W0 /MT /Zi /EHa /c /nologo
  2. AFTER editing those 3 .txt files, open Flexsim and load your model. Next you will need to compile your model, but the type of compile depends on what parts of your model you want to debug. If you are just interested in debugging your C++ model code that you entered in triggers, then a regular compile will work (Flexsim Main Menu>Build>Compile Model F2). If you want to debug library code, i.e. the functionality of the standard Flexsim library, as well as the C++ implementations of the command list, then you will need to compile the entire session (Flexsim Main Menu>Build>Compile Entire Session).
  3. After the compile is finished, open up Visual Studio .NET (Flexsim Main Menu>Build>Open Visual Studio...). In the Solution Explorer – vcpp window (usually in the upper right side of the screen, or accessible from View>Solution Explorer), right click on the “vcpp” tree entry and choose the Properties menu option. The following window should appear. In the Properties window, click on “Debugging” under Configuration Properties in the left panel. You will need to change two of the “Action” options. When you click on the “Command” action, there will be a drop down box open on the right. One of those options will be Browse. Choose that option and browse to your Flexsim install folder in the program folder and choose the “flexsimRTa.exe” file. One thing to note here is that Flexsim alternates between two active files being “flexsimRTa.exe” and “flexsimRTb.exe”. So, if you get an error when going into debug mode saying that it can’t attach, try using the other file in this Command action area (or compile Flexsim once more).
  4. Now click on the “Attach” action and choose “Yes.” The Properties should now look like the following screenshot:
    Click image for larger version

Name:	vcpp Properties.jpg
Views:	662
Size:	22.5 KB
ID:	244
  5. Press OK to close the vcpp Property Pages.
  6. Go to the Debug menu option in Visual Studio and choose start (F5). A message will pop up saying that project configurations are out of date, and asking if you want to compile? Choose the “No” button. At this point you will now be able to set your debug options in Visual Studio or you will get the error message that it can’t attach. If you get the error message you will need to use the opposite file that you put in, in step 3 (either flexsimRTa.exe or flexsimRTb.exe).
  7. After you set the debug options, for example, a break point at one of your code lines, switch back to Flexsim, click Run. When the Flexsim run to the break point, it will automatically switch to Visual Studio. And you can view your variables or step-by-step execute the code in the Visual Studio now.

Last edited by Phil BoBo; 12-22-2011 at 11:20 AM.
Reply With Quote
  #2  
Old 05-06-2008
qin tian qin tian is offline
Flexsim User
 
Join Date: Dec 2007
Location: Shanghai, China
Posts: 137
Downloads: 115
Uploads: 0
Thanks: 59
Thanked 3 Times in 3 Posts
Rep Power: 159
qin tian is on a distinguished road
Default

In flexsim 4.3, There is no flexsimRTa.exe, but it has flexsimRTa.exp,
which should I use?
Reply With Quote
  #3  
Old 05-06-2008
qin tian qin tian is offline
Flexsim User
 
Join Date: Dec 2007
Location: Shanghai, China
Posts: 137
Downloads: 115
Uploads: 0
Thanks: 59
Thanked 3 Times in 3 Posts
Rep Power: 159
qin tian is on a distinguished road
Default

I use flexsim.exe instead of flexsimRTa.exe, and in flexsim I compile a model with only a queue, then it gives compile error.

The big problem is that I cannot revert to original situation. I restored the config files and the property in VS 2008, but it still give error.
Help.
Reply With Quote
  #4  
Old 05-06-2008
Anthony Johnson's Avatar
Anthony Johnson Anthony Johnson is offline
Manager of Product Development
 
Join Date: Jul 2007
Posts: 440
Downloads: 86
Uploads: 4
Thanks: 171
Thanked 899 Times in 288 Posts
Rep Power: 732
Anthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond repute
Default

If you've compiled at least once in Flexsim, then there should be a flexsimRTa.exe in your Flexsim4\program directory. You should choose that one. You can get the exact compile error by opening your compiler console and then compiling. What is the exact error?
Reply With Quote
  #5  
Old 05-06-2008
AlanZhang's Avatar
AlanZhang AlanZhang is offline
Flexsim Super Moderator
 
Join Date: Aug 2007
Location: CA
Posts: 289
Downloads: 64
Uploads: 0
Thanks: 88
Thanked 91 Times in 47 Posts
Rep Power: 223
AlanZhang is a jewel in the roughAlanZhang is a jewel in the roughAlanZhang is a jewel in the rough
Default

On my computer, both allobj.txt and allobjectsobj.txt has the following line:
cl /W0 /MT /EHa /c /nologo
, not
cl /W0 /ML /Zi /EHsc /c /nologo

Will it cause any problem?
__________________
Best,
Alan
Reply With Quote
  #6  
Old 05-06-2008
Anthony Johnson's Avatar
Anthony Johnson Anthony Johnson is offline
Manager of Product Development
 
Join Date: Jul 2007
Posts: 440
Downloads: 86
Uploads: 4
Thanks: 171
Thanked 899 Times in 288 Posts
Rep Power: 732
Anthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond repute
Default

Oh, yes, I need to change the article. It should be /MT /Zi /EHa /c /nologo.
Reply With Quote
  #7  
Old 05-06-2008
qin tian qin tian is offline
Flexsim User
 
Join Date: Dec 2007
Location: Shanghai, China
Posts: 137
Downloads: 115
Uploads: 0
Thanks: 59
Thanked 3 Times in 3 Posts
Rep Power: 159
qin tian is on a distinguished road
Default

The problem is resolved.

I cannot compile to generate the flexsimRTa.exe, so I uninstall Flexsim and reinstall.

Then I compile a simple model with only one queue, no error this time, but still no flexsimRTa.exe.

Then I give command build->make all code c++, and compile again, this time it generate flexsimRTa.exe. So, all problems are resolved.
Reply With Quote
The Following User Says Thank You to qin tian For This Useful Post:
Jörg Vogel (07-03-2008)
  #8  
Old 07-18-2008
Normand Côté Normand Côté is offline
SNC-Lavalin GTS
 
Join Date: Aug 2007
Location: Montreal, Canada
Posts: 17
Downloads: 21
Uploads: 0
Thanks: 1
Thanked 24 Times in 13 Posts
Rep Power: 168
Normand Côté will become famous soon enough
Default Debugger limitation

Hi Anthony,

Is there a limitation in the number of objects that can be debugged with VS2008 Express edition ? Referencing the picture below, I can set a breakpoint in ObjectFunction2259 but not in the next one.
Attached Thumbnails
Click image for larger version

Name:	debuglimitation.jpg
Views:	453
Size:	19.9 KB
ID:	381  
Reply With Quote
  #9  
Old 07-18-2008
Anthony Johnson's Avatar
Anthony Johnson Anthony Johnson is offline
Manager of Product Development
 
Join Date: Jul 2007
Posts: 440
Downloads: 86
Uploads: 4
Thanks: 171
Thanked 899 Times in 288 Posts
Rep Power: 732
Anthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond repute
Default

Normand,
I don't know of any limitation in Express 2008. Honestly, I'm baffled by your problem. You might try and look in the Express documentation or on Microsoft's web site to see if there is any limitation.
Reply With Quote
Reply

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
Print information into output console (Debugging) Tom David Q&A 11 09-04-2008 03:46 AM
Configure Flexsim 4.01 with Visual Studio Express susanne Installation 1 03-31-2008 04:28 AM
Visual Studio 2005 or 2008? Lars-Olof Leven Q&A 16 01-02-2008 12:10 PM
Visual Studio 2005/VISTA David Chan Q&A 1 01-01-2008 03:51 AM
Stop message with information (Debugging) Tom David Tips and Tricks 0 09-20-2007 01:10 AM


All times are GMT -6. The time now is 03:35 AM.


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