This is an ongoing task in the direction to compile GEOtop 2.0 under Eclipse and subsequently to embed part of it in OMS v3.
Since to work with GEOtop 2.0 one needs to be aware of what meteoIO does, I started from it.
To keep it simple, I first compiled the meteoIO libraries as described in the related post, by command line (compiling meteoIo under Eclipse will be a further task to explore eventually). Then I open Eclipse. For the occasion I did a new installation of the recent Luna IDE, installing the default CDT for managing C/C++ projects.
I created a new project for one of the examples (by command line and following the instructions given in meteoIO website you can compile all the examples at once. However, if you get in problems to execute them, you do not know what to do, and you need to go to explore the examples content. Then you need a IDE or, at least a text editor, to browse the files ….).
Then you have to add the example file you need. Assume, for instance, the file called time.cpp.
Import it in Eclipse by using
- ->File
- ->Import
- ->File System
- -> Next Button
- -> Browsing directories
- -> Selecting the desired file by checking the box
- -> Finish
Before compiling successfully you have to tell the compiler two things: where the include files of the meteoIO files are (which contain the definition of all the meteoIO methods), and where the meteoIO libraries are. The first is required for compile time, the second for linking time.
In particular the libraries of meteoIo are meteoio, meteoio.2, and meteoio.2.4.3 (please note that each of them, under Mac OS X is written as lib*.dylib, where * stands for any of the three names above). I actually placed them in one of my working directory but a standard choice would be probably better.
The includes files were instead placed under /usr/local/include (they were actually under /usr/local/include/meteoio but the last directory is specified inside the code)
So here they are the instructions for making the libraries visible to the linker:
- -> right click on the project
- -> find “Properties” on the menu and click it
- -> choose “C/C++ General”
- -> choose “Path and symbols”
- -> select Libraries
- -> click on Add
- -> specify the name of the libraries (without lib and .dylib)
- -> select Libraries Path
- -> click on "Add"
- -> specify the path were the linker can locate the libraries
- -> Finish
Here you find instead the instructions to for making visible the include files:
- -> Right click on the project
- -> Select Properties
- -> Expand the options
- -> choose “C/C++ General”
- -> choose “Path and symbols”
- -> Browse the filesystem to find the /usr/local/include directory [details as above]
- -> Finish
Then you are ready to build your project and execute it. ^1^2^3
______________________________________________________________________________
^1 - Please be aware that when you change building option, e.g. from "Debug" to "Release" option of Building (the hammer Icon in Eclipse) you have to said again where the library are to the linker. Actually there is a checkbox that you can select for importing the the configuration in both the Debug and Release modes.
^2 The executables can be found under the Workspace Folder/Project Folder/Release, where "WorkSpace Folder" is the directory declared at the starting of Eclipse, "Project Folder" is the name of the current project.
^3 Many MeteoIO example require something in input and do not fail gracefully when this input is not provided (they give the error code "segmentation fault 11).
______________________________________________________________________________
^1 - Please be aware that when you change building option, e.g. from "Debug" to "Release" option of Building (the hammer Icon in Eclipse) you have to said again where the library are to the linker. Actually there is a checkbox that you can select for importing the the configuration in both the Debug and Release modes.
^2 The executables can be found under the Workspace Folder/Project Folder/Release, where "WorkSpace Folder" is the directory declared at the starting of Eclipse, "Project Folder" is the name of the current project.
^3 Many MeteoIO example require something in input and do not fail gracefully when this input is not provided (they give the error code "segmentation fault 11).
No comments:
Post a Comment