This article is part of Writing and cross-compiling C/C++ programs for IOT+. This is an example that shows how to write C++ program for cross compiling.

 

After Netbeans started, Firstly, you have to create a project. Click File->New Project, select C/C++ Application.

 

Gives the project name, creates a main C++ source file, selects mips-2015.11 on the Tool Collection.

 

You should see the source code tab, you can write some statements.

 

To compile the source correctly, you have to change the project properties. Click File->Project Properties to bring up properties dialog box. On C++ Compiler category, two properties  needs to change

1) Include Directories, add following directory paths

		/media/user/rootfs/usr/include
		/media/user/rootfs/usr/include/mipsel-linux-gnu

2)Additional Options, put -EL and -D_GLIBCXX_USE_CXX11_ABI=0

"-EL" specifies to generate little endians MIPS code
"-D_GLIBCXX_USE_CXX11_ABI=0" specifies to use correct C++ ABI version on MIPS Debian 8.1.

 

On Linker  category, two properties  needs to change.

1) Additional Library Directories, add following directory paths

		/media/user/rootfs/usr/lib
		/media/user/rootfs/usr/lib/mipsel-linux-gnu
		/media/user/rootfs/lib

2)Additional Options, this part is optional but mostly of time in a program linking to other
external libraries are very often. The example here is to link XML library, compression libraries.

              -lxml2 -lz -llzma

 

 

Now, you're ready to build the project, click Run->Build Project. If you set thing correctly, you will see the success build on the Output tab.

 

The output binary helloworld1 will be in MIPS code. Finally, you can copy this binary program to the IOT+ board to run.