Wednesday, 10 March 2010

Player/Stage on Eclipse

Today I've found myself trying to set up Eclipse as my IDE for Player/Stage after moving some files and somehow deleting all the settings. I'm using an Eclipse specifically for C/C++ development, which you can get here:

This is how I set it up for Player/Stage:

Open up Eclipse and select Project (from the top menubar) then Properties. Select the C/C++ Build >> settings from the left sidebar. Tool Settings should be the default tab that is open.
You should now have a window that looks like this (click to enbiggen):

Under the GCC C++ Compiler select the Miscellaneous tab and paste into the "other flags" box:
`pkg-config --cflags playerc++`

Similarly, under the GCC C Compiler select the Miscellaneous tab and paste into the "other flags" box:
`pkg-config --cflags playerc`

To set up the linker (which is what connects the object files together into a working binary which can then be executed) select the Miscellaneous tab under the GCC C++ Linker and into the Linker flags box paste:
`pkg-config --libs playerc++`

If you want to develop in C rather than C++ then paste `pkg-config --libs playerc` into the box instead.

It will probably work now if you have the PATH set on your computer properly. It didn't work for me so I told Eclipse where to look for all the Player libraries. Under the GCC C++ Compiler select the directories tab and paste the location of the folder containing the player headers. On my computer this was /usr/local/include/player-3.0/libplayerc++ it will probably be different on different computers. Do the same for the directories tab in the GCC C Compiler section.

Congratulations. You can now start working on some Player/Stage code in Eclipse! If you need to test your code it is still necessary to start a Stage simulation by opening a terminal and running $ player yourcfg.cfg. Then when you hit run in eclipse it'll compile and then start running your code on that simulation.


  1. Hi, I'm having trouble following these instructions. I don't have the same setup where the "C/C++ Build" is visible. I tried eclipse 3.2 and eclipse galileo 3.5. Do I have to intall some plugin to get these options? What verison of eclipse do you have and can you tell me of any other possible software/package that I may need (I'm using Ubuntu v8). Thanks

  2. Hi Hussain, I use the CDT version of eclipse that's optimised for C/C++ development. Since all the coding I ever do is in Player/Stage it's better for my work that the normal java eclipse.
    You can download this version from here:

    Or go to the eclipse downloads page here: and install the C/C++ IDE.

  3. Thank you for your work~!^^
    I could set up my IDE for player/stage.
    JaeGon From Korea~

  4. hi, have u worked on map building or localization of robot .. i need help in implementing the same .. or how to implement the existing vfh , amcl and wavefront drivers.
    thx in advance

  5. Hi Jenny, thanks for this small tutorial, it helped me a lot,
    regards from Germany!

  6. Thank you for your sharing, Jenny. Your Player/Stage manual is helpful, too ;-)

    Regards from Hong Kong,

  7. Thank you from Berlin Germany.

    Best regards.

  8. Thanks for your post, it was helpfull to try it but it does not work for me. I have eclipse cdt, ubuntu 12.04,player 3.0.2. Player works fine when I call it from a terminal. I got an error "undefined reference" when I tried to build the project. Anyone has idea?
    Best regards from Argentina.

  9. well after doing all the above steps i got this error..... after trying much i am unable to sort it out...

    undefined reference to `PlayerCc::PlayerClient::PlayerClient(std::basic_string, std::allocator >, unsigned int, int)'

    can anyone help me regarding it?

  10. This comment has been removed by the author.

  11. Thanks Jenny.

    I have got Undefined Reference to Player client.
    I have done the following and its resolved:

    "Undefined Reference" means you're not linking against the libplayerc++ library. In the Eclipse project settings, go to C++ Build -> settings, then find the "libraries" button under the Linker options. Add "playerc++" to the Libraries, and (probably) "/usr/local/lib" to the library search paths if that's where you installed Player.

    Thanks to

  12. Hi everyone,
    here's a link to install player and stage with no errors,work for me:
    Hope it helps others too :)