Webots User Guide - chapter 5 - section 1

Webots User Guide


5.1 Webots Built-in Editor

Webots source code editor is a multi-tab text editor specially adapted for developing Webots controllers. It is usually recommended to use this editor as it makes the compilation straightforward. The editor features syntax highlighting for Webots supported language (C/C++, Java, Python and MATLABTM) and auto-completion for Webots C API.

text_editor

Figure 5.1: Webots Text Editor

5.1.1 Compiling with the Source Code Editor

The Source Code Editor can be used to compile C/C++ or Java source files into binary executable or bytecode (Java) files that can be executed in a simulation. The compilation output is printed to Webots console; errors and warnings appear in red. If you double-click an error message, Webots will highlight the corresponding source line in the editor.

Note that, for compiling source code it is necessary to have the appropriate development tools installed. You will find information on the development tools here.

The Compile button launches the compilation of the currently selected source file. Only the current file is compiled, not the whole project. Webots invokes gcc, g++ or javac depending on the extension of currently selected source file.

Builds the whole project by invoking make in the selected file's directory. With C/C++, the Build button compiles and links the whole project into an executable file. C/C++ source file dependencies are automatically generated and updated when necessary. With Java, the Build button compiles the whole project into bytecode (.class files).

The Clean button invokes make clean to delete the intermediate compilation files in the current file's directory. The source files remain untouched.

The Make JAR file menu rebuilds the whole project and packs all the .class in a .jar. This is a convenience function that can be used to pack a complete controller prior to uploading it to one of our online contest website.

The Cross-compile button allows to cross-compile the current text editor's file. Note that a specific Makefile is required in the controller's directory for performing this operation. For an e-puck robot, this Makefile must be named Makefile.e-puck.

The Cross-compilation clean menu allows you to clean the cross-compilation files. Note that a specific Makefile is required in the controller's directory for performing this operation. For an e-puck robot, this Makefile must be named Makefile.e-puck.

release 7.0.2
Copyright © 2012 Cyberbotics Ltd. All right reserved.