Integrations (PTC products, 3rd party products and code) > Code integration (Ada, ARINC 653, C, C#, C++, IDL, Java, SQL and VB) > C++ code > Generating C++ code > Generating C++ code for system simulation > Generating C++ code for simulation of a system > Generating C++ code for simulation of a system and automatically building the application (C++ code)
  
Generating C++ code for simulation of a system and automatically building the application (C++ code)
This topic provides information for generating C++ code for simulation of a system and then automatically building the application for simulation from that generated code.
To automatically build the application after code generation you must apply the «Build Rule» stereotype to the root Package. After applying the «Build Rule» stereotype to the root Package, the following commands are available when you right-click the Package and point to Execute:
Build Executable - generates the C++ code and builds the application.
Rebuild Executable - generates the C++ code and rebuilds the application ensuring that all files are recompiled.
Run Executable - runs the application without generating the C++ code or building the application.
Build&Run Executable - generates the C++ code, builds the application, and then runs the application using the runme.bat file.
The «Build Rule» stereotype also applies two Tag Definitions to the root Package:
Build Configuration - specifies the compiler/platform to use to build the application, for example, VC2012Release.
Build Script - You should not need to change this script, which is copied from the DefaultScriptText constraint that is applied to the Build Script tag definition when ACS first generates the C++ code. The script supports Microsoft Visual Studio, but can be extended to support other compilers.
This topic covers use of the Build Executable command, which performs the following tasks:
Uses ACS to generate the C++ code, including two additional files named Maker.cfg and ProjectFiles.src.
Uses PowerMaker and the Maker.cfg and ProjectFiles.src files to generate two files named AtegoMakeFile.mak and AtegoEnvFile.bat.
Executes the 'make' utility of the target compiler environment using the AtegoMakeFile.mak file.
Generates a runme.bat file that runs the application.
Any errors are reported in the ACS/TDK Log pane.
To generate C++ code for simulation and automatically build the application:
1. Ensure that you have built the dependent libraries. How?
2. Right-click the root Package for generation, point to Links > Stereotypes, and then click Build Rule.
3. Open the Package's Property Pages, click the Build Rule tab, and then select the Build Configuration that is required to build the application on your computer.
4. Ensure that ACS is running.
When ACS is running, on the ACS/TDK Control toolbar the Load or Unload ACS toolbar button is selected.
5. Right-click the root Package, point to Executable, and then click Build Executable.
ACS generates the C++ code and then Visual C++ builds the application.