Building and debugging C/C++ programs with Eclipse IDE

This article describes how to setup Eclipse IDE for C/C++ Developers and OpenWrt SDK to build and debug programs running on LinkIt Smart 7688 development board.

After proper setup, Eclipse will be able to build, upload and attach debugger to your C/C++ program that runs on target LinkIt Smart 7688 development board. This can be pretty helpful if you are writing your own C/C++ programs.


  • LinkIt Smart 7688 or LinkIt Smart 7688 Duo development platform.
  • Mac OS X or Ubuntu Linux machine to run the OpenWrt SDK. If you haven't set it up yet, follow the cross compilation instructions to make sure the SDK is ready to use.
  • Eclipse IDE for C/C++ Developers.
  • Eclipse IDE requires JVM. Follow the IDE instructions to install the corresponding JVM version.

Quick steps

  • Install and setup SFTP on LinkIt Smart 7688 development board with opkg.
  • Install Eclipse C/C++ GCC Cross Compiler Support and Remote System explorer End-User Runtime. Newer versions of Eclipse may have these packages installed already.
  • Create an Eclipse C/C++ Cross GCC project.
  • Setup STAGING_DIR environment variable, tool command prefix, tool path and GDB tool path in the project settings.
  • Build and setup sign-in password to LinkIt Smart 7688 development board.
  • The IDE will automatically build, upload and execute the resulting binary.


Download and setup OpenWrt SDK

Follow the cross compilation guide to download and install the SDK first.

Enable SFTP on LinkIt Smart 7688 development board

First we need to prepare the board to enable the SFTP service. This allows Eclipse IDE to upload binaries and debug files to the board.

Make sure your board is connected to the internet and you have access to the system console. Enter following commands to install and enable the SFTP service. 

opkg update  opkg install vsftpd openssh-sftp-server  /etc/init.d/vsftpd enable  /etc/init.d/vsftpd start

Install and setup Eclipse IDE for C/C++ developers

Download the C/C++ package of the Eclipse IDE:

  1. Download and install Eclipse IDE for C/C++ Developers.
  2. Depending on your system, you may need to install JDK (not JRE) if the Eclipse IDE complains about incorrect JVM version.

Create and configure C project

Create a Hello World project that uses cross compilation toolchain from the LinkIt Smart 7688 OpenWrt SDK.

  1. Launch the IDE, click File, then New and then Project.
  2. In the New Project wizard, select C Project and click Next.
  3. Select Hello World ANSI C Project under Executables and Cross GCC from Toolchains, as shown below.
    • If there is no Cross GCC option, install C/C++ GCC Cross Compiler Support.
      • To install the Cross Compiler Support, Navigate to Help then Install new Software..., find C/C++ GCC Cross Compiler Support ( and install it.
  4. Continue the steps in the wizard until you see the Cross GCC Command settings, as shown below:
  5. Click Finish and the wizard to create the project.
  6. Setup the STAGING_DIR environment variable required by OpenWrt SDK. From the menu click Project then Properties.
  7. Navigate to Environment under C/C++ Build. Here you can set additional environment variables required by the build system. 
    • Variable: STAGING_DIR
    • Value: OpenWrt_SDK/staging_dir/ where OpenWrt_SDK is the path to your OpenWrt SDK directory. An example setup is shown below:

Build the Hello World project

Since the code is already generated by the wizard, proceed to build the project. Click Project then Build All from the main menu. If the setup is correct, you should see a build log similar to this: 

15:41:52 **** Incremental Build of configuration Debug for project HelloWorld ****  make all   Building file: ../src/HelloWorld.c  Invoking: Cross GCC Compiler  mipsel-openwrt-linux-uclibc-gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/HelloWorld.d" -MT"src/HelloWorld.o" -o "src/HelloWorld.o" "../src/HelloWorld.c"  Finished building: ../src/HelloWorld.c    Building target: HelloWorld  Invoking: Cross GCC Linker  mipsel-openwrt-linux-uclibc-gcc  -o "HelloWorld"  ./src/HelloWorld.o     Finished building target: HelloWorld  
It will also generate a mips/le binary - this is the executable to debug in the next step. 

If there are compiling or linking errors, check the settings in the previous steps.

Debug the Hello World project

Next, configure the IDE to upload the executable file automatically and debug with gdb remotely.

  1. Make sure your computer is in the same Wi-Fi network as LinkIt Smart 7688 development board. In this example you'll use the default domain name mylinkit.local. Make sure you can access the system console with SSH.
  2. Click Run then Debug Configurations... from the main menu.
  3. In the dialog, select C/C++ Remote Application then click New.
  4. Click New... connection, as shown below: 

    Set Host name to mylinkit.local. Also set Default User Id to root

  5. Define Remote Absolute File Path for C/C++ Application as /tmp/HelloWorld. You may also browse for another path.
  6. Now select the Debug tab. Set the GDB Debugger path to


    where OpenWrt_SDK is the path to the OpenWrt SDK.

  7. Click Apply then Debug. The IDE will now upload the built executable to LinkIt Smart 7688 development board through SFTP service. Enter the root password of the board, if the IDE prompts you to do so.
  8. The IDE now starts a gdbserver on the board, then connects Eclipse debug view to it. By default, it will break at the first line of the main() function.

You've now successfully built and debugged and application on Eclipse IDE with LinkIt Smart 7688 as a target device. You may use this reference application for further development.