# This header is for providing additional information to hugo for the website generation it ignored by asciidoctor

title: "Compiling and Debugging 4diac FORTE with Eclipse" url: doc/installation/eclipse.html page_css_file: /4diac/css/4diac_doc.css sidebar: - sb-doc ---

# Compiling and Debugging 4diac FORTE with Eclipse

## Get C/C++ support for Eclipse

1. Unless you already use Eclipse, for example to build 4diac IDE from source, download http://www.eclipse.org/downloads/Help → Install New Software, choosing your Eclipse version (1) and checking Programming Languages → C/C++ Development Tools (2).

2. Restart `eclipse.exe`

3. Choose a workspace directory. This will be the directory where your C/C++ projects will be located. It is recommended to set the workspace folder one level above the entire source code folder. Please avoid any spaces in its names. Otherwise you might get problems when compiling 4diac FORTE.

## Compile 4diac FORTE with Eclipse

The build process is described in the installation tutorial. Perform the steps described there but consider the following adaption:

When generating a project with CMake you must choose the correct project type. You need to direct CMake to creating an Eclipse project. This depends also on the compiler you installed. For MinGW64, it is Eclipse CDT 4 - Unix Makefiles.

Then compile the project as follows:

1. Import 4diac FORTE by File → Import…​ → General → Existing Project into Workspace. If your Workspace is one folder above your source code folder you only have to click on Browse…​ and OK afterwards to import 4diac FORTE into Eclipse. Otherwise, select the directory where you have extracted your 4diac FORTE and check Copy into workspace (otherwise the source will stay at the original place).

2. Start Make Targets View by Window → Show View → Build Targets unless it is open already. Double-click the makefile: bin/[YOUR_SYSTEM]/all to compile 4diac FORTE to an executable application. If you don’t see the targets (all or clean), you can create them in the same window. Make sure that you create them in the correct folder.

## Debug 4diac FORTE with Eclipse

For debugging your own Function Blocks, go through the following steps:

1. Set a breakpoint in the source code file of the desired Function Block.

2. Go to Run → Debug Configurations…​

3. Right click on C/C Application → New#. In the [.tab4diac]#Main# tab, you should fill the [.specificText]#C/C Application: with the binary file you generated (normally `FORTE_FOLDER_ROOT/bin/[YOUR_SYSTEM]/src/forte[.exe]`). In the Debugger tab, choose your desired debugger. In Windows you normally use MinGW64 (you have to install them in order for them to appear in the selection box).

4. Click Debug.

5. Confirm for changing into the Debug view.

6. If you don’t see the file where the debugger stopped at the beginning, press the Locate File button (1) and navigate to the Eclipse workspace which contains the extracted 4diac FORTE, type main into the search field of the Windows Explorer and select `main.cpp`. 4diac FORTE is now stopped at the main() function.

7. Press the Resume button (2) to run 4diac FORTE and observe the behavior of your application.

8. Always press the Terminate button for stopping a 4diac FORTE launched within Eclipse. This avoids 4diac FORTE running in the background (not always shown in Task Manager).

## Where to go from here?

If you want to build a 4diac FORTE, here is a quick link back:

Install Eclipse 4diac

After you installed all required tools, it’s time to start using them. Take a look at the following page:

Step by step tutorial

If you want to go back to the Start Here page, we leave you here a fast access

Start Here page

Or Go to top