Building Programs

The install kit provides a utility call nxbuild that can be used to build simple programs:

Example 1.14. use nxbuild to build simple programs

nxbuild -o test test.c


This script links in the various libraries for you and reading its contents would provide the necessary information for creating a separate Makefile. You can also use nxbuild with the example files in the NeXus distribution kit which are installed into /usr/local/nexus/examples --- Note that the executable name is important in this case as the test program uses it internally to determine the NXACC_CREATE* argument to pass to NXopen.

Example 1.15. building and running a simple NeXus program

nxbuild -o napi_test-hdf5 napi_test.c  #  builds HDF5 specific test
./napi_test-hdf5


NeXus is also set up for pkg-config so the build can be done as

Example 1.16. use of pkg-config to build simple programs

gcc `pkg-config --cflags` `pkg-config --libs` -o test test.c