How to configure PowerDEVS project in Eclipse

Install eclipse in CentOS

Follow instructions here but download latest eclipse (in 64 bits usually):

http://www.if-not-true-then-false.com/2010/linux-install-eclipse-on-fedora-centos-red-hat-rhel/

Getting and installing PowerDEVS

Follow the steps here to get the PowerDEVS source code and compile it.

Create the Eclipse project

  1. Open Eclipse
  2. File -> New project --> Makefile project from Existing Code
  3. Project Name: 'powerdevs'. Location: path to where you cloned the repository. Toolchain: Linux GCC. Finish

Setting up the Run Configuration in Eclipse

To configure Eclipse to compile and run your models, go to Run --> Run Configurations and double-click on C/C++ Application in the left menu. After this, fill in the details as shown in the following images:

image.png</verbatim>

image1.png</verbatim>

NOTE: make sure the working directory is properly set in this last creen! You should click on File System... and browse to the output folder inside your PowerDEVS root directory.

Enable Eclipse compilation

Before running your simulations, it is important to create the Makefile using PowerDEVS (with the simulate button) whenever the coupled models are updated (the simulate button creates a file named makefile.include according to the atomic models defined, and updates the model.h header with the connections).

Also, you should create a new “build configuration” to be able to build from Eclipse:

  1. Right-click on your project and select Build Configurations --> Manage... --> New...

  2. Name: CERN (for example). Copy from “Default”, then OK/Apply

  3. Project --> Properties --> C/C++ build -> [tab] Builder Settings

  4. Select recently added configuration, in this case CERN.

  5. Uncheck the checkbox Generate Makefile automatically if it isn't already.

  6. Set build location to the build folder inside PD (for example: ${workspace_loc:/powerdevs/build}). You may also click on File system... to browse to your folder directly.

  7. Right-click on your project and select Build Configurations --> Set active --> CERN (or your custom config name)

Build config</verbatim>

Putting everything together

In order to test your newly created Eclipse project and build configuration, you can use the basic example introduced here. After following the steps described there, go to your Eclipse project and click on Run --> Run. You should eventually get a plot similar to the one attached in the example description.

Enable c++11 intellisense support

  1. http://stackoverflow.com/questions/17687984/cant-find-the-tool-settings-in-eclipse-cdt

  2. http://stackoverflow.com/questions/17457069/enabling-c11-in-eclipse-juno-kepler-luna-cdt

  3. http://wiki.eclipse.org/CDT/User/FAQ#CDT_does_not_recognize_C.2B.2B11_features

C++11 support in Eclipse Kepler Service Release 1 (Build id: 20130919-0819)

In the latest release Eclipse Kepler SR1 you only have to add -std=c++11

  1. Right click on your project and click Properties

  2. Navigate to C/C++ General and Preprocessor Include Paths, Macros etc.

  3. Select the Providers tab

  4. Add -std=c++11 to Command to get compiler specs :

  5. Apply changes, the Index should be generated automatically.

The "Command to get compiler specs:"-line should look like:
${COMMAND} -E -P -v -dD "${INPUTS}" -std=c++11

C++11 support in Eclipse Neon

In this Eclipse version, the C++11 support configuration has changed a bit.

  1. Right click on your project and click Properties

  2. Navigate to C/C++ General and Preprocessor Include Paths, Macros etc.

  3. Select the Providers tab

  4. Select the CDT GCC Built-in Compiler Settings item from the list

  5. Uncheck "Use global provider..."

  6. In Command to get compiler specs input, add -std=c++11

  7. Apply changes, the Index should be generated automatically.

Builder settings</verbatim>

In both cases, if you want to test that Eclipse has now C++11 enabled, you can create a Hello World project with the following code. This code will have errors in case some part of the previous configuration went wrong.


#include 
#include 
#include 
using namespace std;

vector vs = {"first", "second", "third"};

int main() {
   cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
   for(auto x : vs)
   {
      cout << x << endl;
   }
   return 0;
}

-- MatiasAlejandroBonaventura - 2016-04-07

Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng Screenshot_from_2017-06-28_18-32-01.png r1 manage 166.0 K 2017-06-28 - 23:33 UnknownUser Built in compiler settings
PNGpng Screenshot_from_2017-06-28_18-33-16.png r1 manage 150.7 K 2017-06-28 - 23:34 UnknownUser Build configuration
PNGpng image.png r1 manage 119.8 K 2017-03-21 - 16:44 UnknownUser  
PNGpng image1.png r1 manage 105.0 K 2017-03-21 - 16:44 UnknownUser  
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r5 - 2018-08-10 - LucioEmilioSanti
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback