We no longer use this approach and this page may be out of date – it is left here for archive puropses.  We now use NetBeans for C/C++ development on the RPi, see here.

Using A Windows PC to develop C code for your Raspberry Pi can be done.

These notes on how to do it below are based very much on Alessio Placitelli's great guide which details the steps required and you may wish to follow his original guide instead.

Note that Eclipse is not for the faint hearted! It is a very powerful but very complex programming IDE which can easily confuse the hell out of you and have you banging your head against a wall for hours if it doesn't just work, often because something has changed requiring some new set-up step to make things work as before or work the same on your system compared to the system of someone who has created a set-up guide (just like this one!). The be fair to Eclipse, this isn't so much it being a bad program (actually once setup right its fantastic to use), but more that it is designed to be used in a wide range of situations rather than being a manufacturer produced self configuring software package for a single specific use like many other programming IDE's.  If you are new to C programming by all means give this set-up a go, but if it doesn't work out it isn't just you – loads of perfectly competent programmers have problems understanding Eclipse and the tools it connects with well enough to make it work right for them! Following our Geany based guide is a much easier and simpler way to get up and running with programming in C on the Raspberry Pi if Eclipse defeats you for now.

One other word of warning – this solution uses a cross compiler, which is how you are able to compile on an Intel platform for the ARM based Raspberry Pi.  This is fine if you are using the standard C libraries and maybe one or two additional libraries you can manually copy over such as the RPI IO pin library, SQL server library.  However its a major problem if you want to use libraries with a large number of dependent libraries, for instance programming GTK+ applications, as the libraries are not part of the cross compiler and you need to get pretty advanced dealing with how to copy them over so eclipse can reference them.  At this point its a bit easier if you are using eclipse on a Linux OS but its still a major problem as Linux on a PC will be running on Intel not ARM so the libraries are different. If you want to do programming like this  you will either need to find a way of getting the library files passed to eclipse from the RPi or instead work on the RPi itself and accept its hardware limitations (the fact that the compiler just works with all its installed libraries vs being slower to use than a general PC).

That all said, getting eclipse working as described below is very cool and very productive, but best to be informed up front rather than finding out the hard way!

Setting Up Your Windows PC

Setup Cygwin on your machine

Cygwin gives your Windows machine the Linux functionality needed.

Download the setup.exe file from here and store it in a folder called "c:\cygwin"

Run it (right click and select Run as administrator – we're not sure this is needed, but we ran into problems with our first installation and tried this on a subsequent successful installation which worked)

At the 'Select Packages' page ensure the following are set to install:

  • Python >python: Python langauge interpreter
  • Shells > bash: The GNU Burne Again SHell
  • Shells > mintty: Terminal emulator with native Windows look and feel
  • Devel > make: The GNU version of the 'make' utility
  • Devel > binutils: The GNU assembler, linker and binary utilities
  • Devel – entire folder (we're not sure this is actually needed, but we ran into problems with our first installation and tried this on a successful subsequent installation instead of just make and binutils to ensure everything was present).
  • Debug – entire folder (we're not sure this is actually needed but added it on our installation just in case – however if you are short on disk space leave it out ande see how you go as it adds a few GB of files.).
Install the cross-compilation toolchain

This allows us to use windows but to compile and debug software which runs on the Raspberry Pi ARM.

Download the hardfp version (arm-unknown-linux-gnueabi-hardfp-gdbV1.zip) of the toolchain kindly shared by IanLinsdell, available from his github account. Note that if you don't have git software click the ZIP download button to get the files.

Unzip it into C:/cygwin/opt/cross/x-tools so that the full path is like this C:/cygwin/opt/cross/x-tools/arm-unknown-linux-gnueabi.

Note that this must extract without errors – if you get a filename too long message extract it to a directory straight off C:\ and move it afterwards

Install PuTTY

PuTTY is used to communicate with the Raspberry Pi using SSH.

Download the windows installer for PuTTY from here.

Use Alessio Placitelli's nifty little hack to create a script which run as a post-build step in Eclipse to upload the file to the board using SSH and executes a few commands.

Save the following as "C:\eclipse\deployment_scripts\rpi_deploy_debug.bat"

@echo off
rem Check for a valid filename
IF "%1"=="" (
    ECHO You have to provide a valid source file.
    EXIT /b
IF "%2"=="" (
    ECHO You have to provide a valid destination path.
    EXIT /b
SET PUTTYSCP_BIN="C:\Program Files (x86)\PuTTY\pscp.exe"
SET PUTTY_BIN="C:\Program Files (x86)\PuTTY\putty.exe"
SET PASSWORD=raspberry
SET CMD_FILENAME=commands.sh
rem Upload the file to raspberry pi
rem Build a list of actions to do on the pi (chmod, execute GDB server)
if exist %~dp0%CMD_FILENAME% del %~dp0%CMD_FILENAME%
rem echo rm "%2" >> %~dp0%CMD_FILENAME%
echo chmod +x "%2" >> %~dp0%CMD_FILENAME%
echo gdbserver :3785 "%2" >> %~dp0%CMD_FILENAME%
rem Execute the action list on the raspberry pi
exit /b %ERRORLEVEL%

Edit the file as follows:

  • PUTTYSCP_BIN – The full path to pscp.exe, part of the Putty bundle, used to securely copy files over a SSH connection.
  • PUTTY_BIN – The full path to putty.exe, part of the Putty bundle, used to execute commands on a remote host over a SSH connection.
  • RASPBERRYPI_ADDR – The IP address of the Raspberry Pi
  • USERNAME – The username of the user who will authenticate on the Raspberry Pi
  • PASSWORD – The password
  • CMD_FILENAME – The name of the file which will contains all the commands to be executed on the Raspberry Pi (don’ change, it’s not really needded)
Install Eclipse IDE for C/C++ Developers

Download Eclipse IDE for C/C++ Developers (CDT) from here.

Store it in a folder, for instance "c:\eclipse\eclipse_v#_#"

If you don't have it you also need to install the java runtuime environment (see the readme folder)

Run eclipse by running the eclipse.exe in the folder.

Setup On The Raspberry Pi

Enable The Raspberry Pi SSH Server

The RPi needs to be running a SSH server so we can upload the binaries we compile to it. If you are using the Raspbian OS run this at the command prompt and turn the SSH Server on:

sudo raspi-config

With the SSH server running you can access the Raspberry Pi command line from your Windows machine using a SSH terminal.

Raspberry Pi IP Address

To see your Raspberry Pi IP address type:


If your Raspberry Pi has a new IP address see here.

Other Solutions


Cross Compiling Tools

Cross compiling applications which use external libraries needs all of the necessary libraries to have been cross-compiled from source so they can be included in the build process. Many larger libraries (e.g. GTK+) also depend on other libraries that must also have been cross compiled. This isn't a problem when compiling on the RPi as it can just get the libraries using apt-get all ready to use on its ARM architecture, or get them and then compile them on its own target platform.  But if you are using eclipse on a windows or linux PC, the libraries won't be the same as even your linux PC will be Intel not ARM.  The solution here is to either resort to compiling on the RPi which defeats the purpose of having moved development off it to a faster platform, having to cross compile each required library and all if its dependencies manually, or finding a way to just copy the necessary library files over from the RPi.

Some tools which are designed to help with cross compiling large projects with external libraries:


For info on copying the necessary library files over see here.



We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.


  1. HobertBoles2

    8 years ago

    Excellent comments ! Apropos , if your company needs a a form , my colleague saw a sample form here http://goo.gl/ITrLSG

  2. Frédéric Loreaud

    8 years ago

    Doesn’t this approach makes sense again now that we got PiZero ? Maybe it could use an update.

    1. Adam

      8 years ago

      Netbeans has worked out as a far better solution for us and we’ve not had need to re-visit eclipse. The PiZero is no different to the main Raspberry Pi in terms of developing for it

  3. lovely

    10 years ago

    We are unable to connect X server please help us we have installed Qt4

  4. Quentin Lohri

    10 years ago


    When I compile, finished build target is ok!
    But I’ve a problem with post-build.

    /usr/bin/make –no-print-directory post-build
    upload and debug
    C:/Raspi Studio/deploy_debug.bat/helloRaspi.a “/home/pi/projects/helloRaspi.a”
    /bin/sh: C:/Raspi: No such file or directory
    makefile:43: recipe for target ‘post-build’ failed
    make[1]: [post-build] Error 127 (ignored)

    Idea? It’s 2 day I look for this :(


  5. mimin

    10 years ago

    I have very strange problem. I am able to connect to RPi via Eclipse and I can compile it. However I can not debug it because the endig of the debug file has two poinst instead of one, RPiHello..a instead of RPiHello.a. And of course RPi can not find it. How can I fix it? Thanks.

  6. mikeo

    11 years ago

    Make sure that you download the 32 bit version of Cygwin as the 64 bit version can cause problems.

  7. fali

    11 years ago

    The tutorial is great, but i have a problem with the debugger
    When i start to debug i get the following error:
    Could not determine GDB version after sending: C:cygwinoptcrossx-toolsarm-unknown-linux-gnueabibinarm-unknown-linux-gnueabi-gdb.exe –version

    Any idea?

  8. Martin

    11 years ago

    Great tutorial many thanks!

    I followed this step by step and keep getting “recipe fpr target ‘src/HelloWorld.o’ failed” in subdir.mk of the debug target makefiles.

    I tried to execute the compiler by hand in the cygwin shell and it works fine.
    The echo command (that is used in the line that gets reported with the error) works also.

    Aside from the 64-bin eclipse I also tried a vanilla cdt 32 bit installation. cygwin is also freshly downloaded. The one deviation I made to your tutorial is having cygwin install itself on “D:cygwin”. But the paths should all be correct.

    Im out of ideas what exactly is the problem – maybe you can help?

    1. Ben

      11 years ago

      same problem here, but no deviations.
      running out of ideas…

    2. Martin

      11 years ago

      Sadly, the “gurus” have apparently left this building :(

    3. Adam

      11 years ago

      Sorry this isn’t a support site. If you’re having problems please use one of the many support forums to try and find the answer.

  9. BenR

    11 years ago

    Great tutorial thanks!
    If like me, you get a Segmentation Fault when you try and run a program on the pi, try turning off the Shared Library in eclipse, under C/C++ Build->Settings->Cygwin C++ Linker->Shared Library Settings (untick Shared).
    Worked for me!

  10. s_erno

    11 years ago

    Could someone tell me why we are copying an .a file in the example above? Shouldn’t that be .exe instead? Or am I missing something?

  11. Bryan

    11 years ago

    Thank you for the useful tutorial. I am able to get my project to compile and execute on RPi platform without fail using arm-unknown-linux-gnueabi-, the softfp tools. Unfortunately, it I will get segmentation fault if I compiled the project with the hardfp tools, arm-linux-gnueabihf.

    There is one issue with the softfp tool is, I still could not get the GDB to work in Eclipse Juno, I will get the following issue,

    Cannot access memory at address 0x0
    #0 0xb6fe4568 in ?? () from d:cygwinoptcrossx-toolsarm-linux-gnueabihfarm-linux-gnueabihflibc/lib/ld-linux.so.3
    Cannot access memory at address 0x64
    821 //==============================================================================
    823 int main (int argc, char **argv)
    824 {
    825 #ifdef CFG_DEBUG_MSG
    826 GLenum glerrno;
    827 #endif // CFG_DEBUG_MSG
    829 bcm_host_init();

    If I try with a Hello World project, the GDB will stay idle at Lauching hellow Debug: (84%). The moment I kill the process, I can see Hello World being printed on the console.

    Appreciate if you can give me any insight. Thank you.


  12. Asvaldr

    11 years ago

    ANy chance for help with C++11?
    btw thanks for the tutorial

  13. williamjsell

    11 years ago

    “Append the following to the beginning of the PATH variable: c:cygwinoptcrossx-toolsarm-unknown-linux-gnueabibin;c:cygwinbin;”

    Not sure where this is done. I did this in the computer system advanced settings, but I do not see the option to select the compiler

  14. Claudio

    11 years ago

    I have a issue with post-build process.

    If I run my rpi_deploy_debug.bat in a windows command line (cmd) it works fine, when I try to automate this process through eclipse post-build it fails.

    Eclipse tries to run my .bat with the sh interpreter instead to use cmd
    /bin/sh: C:UsersClaudioDesktopraspautoprpi_deploy_debug.bat: command not found

    how can I fix it?

  15. Iain Chalmers

    11 years ago

    I would just like to add that I managed to get remote debug working but I had to make one change. GDB was failing in Cygwin as it couldn’t find libpython2.6.dll. This error was not presented in Eclipse and all that happened was that it hung launching at 84%. I just realised that user StillSchweiger had commented on the original blog that he had the same issue and had also found the solution!

    For those that find their way here, the simple fix was to have Cygwin install Python 2.6 instead of the default 2.7 and that fixed my problem. I did not use the provided launch script – I had mine setup like Christopher Cantrell. In the remote debug settings, in “Commands to execute before application” I added “chmod +x /home/pi/CC_Projects/*” where /home/pi/CC_Projects is the folder I was launching my application from.

    Currently logging in as root user to the pi (bad, I know, but at least it works for now). Hope this helps others.

    1. Adam

      11 years ago

      Thanks for the tip Iain

  16. Claudio

    11 years ago

    Hello to all,

    I have configured eclipse it seems work properly, my .a runs on my raspberry without problems.

    I have the followed issue,
    /bin/sh: C:Program: command not found

    I have tried to fix it with this tip:

    “If you get /usr/bin/sh: g++: command not found errors you can right click the project > Properties > C/C++ Build > Discovery Options and turn off ‘Automate discovery of paths and symbols for both of the Cygwin tools listed. However this shouldn’t be necessary.”

    Can you to fixed it?

    I attach all eclipse output:

    nfo: Configuration “Release” uses tool-chain “Cygwin GCC” that is unsupported on this system, attempting to build anyway.

    make all

    Building file: ../src/Hello_rasp.cpp

    Invoking: Cygwin C++ Compiler

    arm-unknown-linux-gnueabi-g++ -I”c:cygwinoptcrossx-toolsarm-unknown-linux-gnueabiarm-unknown-linux-gnueabisysrootusrinclude” -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF”src/Hello_rasp.d” -MT”src/Hello_rasp.d” -o “src/Hello_rasp.o” “../src/Hello_rasp.cpp”

    Finished building: ../src/Hello_rasp.cpp

    Building target: Hello_rasp.a

    Invoking: Cygwin C++ Linker

    arm-unknown-linux-gnueabi-g++ -L”c:cygwinoptcrossx-toolsarm-unknown-linux-gnueabiarm-unknown-linux-gnueabisysrootusrlib” -o “Hello_rasp.a” ./src/Hello_rasp.o

    Finished building target: Hello_rasp.a

    /usr/bin/make –no-print-directory post-build

    C:Program Fileseclipsedeployment_scriptrpi_deploy_debug.bat Hello_rasp.a “/home/pi/projects/Hello_rasp.a”

    /bin/sh: C:Program: command not found

    makefile:58: recipe for target `post-build’ failed

    make[1]: [post-build] Error 127 (ignored)

  17. Jim Waschura

    11 years ago

    if eclipse was loaded at c:Program Fileseclipse instead of c:eclipse, then need to add quotes around path names in .bat file. Thanks for documenting this. Worked like a charm.

  18. topherCantrell

    11 years ago

    The latest CDT for Eclipse has a “Cross Settings” panel on the “Tool Settings” tab. I set the “Path” to “C:cygwinoptcrossx-toolsbin” and the “Prefix” to “arm-unknown-linux-gnueabi-“. Then I didn’t have to change the names of the tools … eclipse will prepend the prefix correctly.

    1. Adam

      11 years ago

      Thanks for the tip

  19. ChristianM

    12 years ago

    Hi All,

    here is how I managed the above sought for “final step” to configure Eclipse on a Windows 7 (32 / 64 work both) system, using the above mentioned
    “arm-unknown-linux-gnueabi-hardfp-gdbV1.zip” tool chain from IanLinsdell as a complete development and debug system.

    Now I can compile, upload and debug (yes, stepping through source code lines, halt @ breakpoints and the like) with two mouse clicks or key-strokes on the windows side.

    After having done all configuration steps like mentioned in the guide above I think the trick was setting up a “Remote Systems connection” in Eclipse pointing to the RaspBerry and using this connection in the GDB (DSF) Automatic Remote Debugging Launcher configuration. This way I did not need to use nor install Putty or the deploy strategy. Neither need I to perform any manual steps on the raspberry side to initiate the debugging session.

    After setting up the Remote systems connection via File -> new -> other -> Remote Systems -> connection go to the Debug Configurations dialog and set the “Remote Absolute File Path for C/C++ Application:” pointing to the folder where the application will be running on the Raspberry, e.g. /home/pi/bin/RaspHelloWorld.a. Also, set the “Connection:” selection box in the beforementioned dialog to the name you have assigned the “Remote Systems connection” to your Raspberry.

    Please note that the Remote systems connection must be of the SSH only type and that SSH must be enabled on the Raspberry as well.

    Also, the Gdb debugger entry on the GdbServer Settings tab in the “Debug Configurations” dialog needs to be set to “C:cygwinoptcrossx-toolsarm-unknown-linux-gnueabibinarm-unknown-linux-gnueabi-gdb.exe” (assuming you have installed cygwin and the arm tool chain accordingly).

    Good luck an success,


    1. Adam

      12 years ago

      Nice one Christian, thanks for the info

    2. Still Schweiger

      11 years ago

      Thx a lot for the hint, works like a charm

  20. Pingback: .Getting Your RPi Ready For C Programming « Raspberry Pi Projects


Your email address will not be published. Required fields are marked *