NVIDIA Research

Building the FCameraPro application

Previous: Obtain and install the FCam library

Building FCameraPro with Eclipse

The installation of the TADP included Eclipse, the preferred IDE for Android development.  The first example application you will build is the FCameraPro app. This application is a camera application written entirely using the FCam API. To begin, open Eclipse and create a new project from the existing sample:

  1. Click File -> New Android Project
  2. Select the create project from existing source radio button
  3. Select API level 11
  4. In the location field, click browse and select the root


  1. Click Finish. At this point we have created a pure Java project. Now we will convert it into a mixed Java/C++ project so that you can build and debug both native and Java code from Eclipse
  2. Switch to the 'C/C++' perspective (Window -> Open Perspective -> Other ...)
  3. In the 'Project Explorer' (left pane), right click on the project folder and select 'New' -> 'Convert to a C/C++ Project' option
  4. Select 'Makefile project' as a project type and '-- Other Toolchain --' as a toolchain. Now we have a mixed C/C++ project. We will next configure the C/C++ build properties
  5. In the 'Project Explorer', right click on the project folder and select 'Properties'
  6. In 'C/C++ Build' -> 'Environment' add an NDK_MODULE_PATH variable. If you have not yet set this path, set it to the parent directory of your fcam installation:
    If you have the fcam directory under /Users/myhome/work, then set NDK_MODULE_PATH to /Users/myhome/work. On windows machines, the path should be in the cygwin format /cygdrive/c/users/home/mywork. 

  7. In the 'Properties' -> 'C/C++ Build' -> 'Builder Settings' tab, unselect  the 'Use default build command' option. In the 'Build command' filed, write "bash ${NDKROOT}/ndk-build". In addition, the 'Build directory' location should be set to ${workspace_loc:/<project-name>/jni}, where <project-name> is the name of the project in the Eclipse workspace.
    Optionally, you can use the build command "base ${NDKROOT}/ndk-build NDK_DEBUG=1" to build a debug version. You can also consider adding the "V=1" option for verbose compilation output or the "-j <n>" option to spped up the compilation on multi-core machines, where <n> is the number of CPU cores to use.

  8. Build and install the application as you would build any other Android application. In Eclipse, right click on the project name iand select 'Run As' -> 'Android Application'. Make sure your Tegra device is plugged in - you should see the FCameraPro app launch on the device!
  9. The same steps can be used to build the examples under fcam/examples.
  10. Optionally, you can setup the Eclipse search paths for C++. Right click on the project -> 'Properties' -> 'C/C++ General' -> 'Paths and Symbols' -> 'Includes' -> 'GNU C++' and add the following three directories:
    <fcam-root>/include   e.g. /Users/myhome/work/fcam/include

    Eclipse will ask whether you want to reindex the project, answer yes. Now Eclipse supports better following up from the editor window to the include files, function definitions, syntax completion, etc.

  11. This is all for FCameraPro. You can also look into the example under fcam/examples. When you run the examples, these assume that the directory /data/fcam exists on the device. Create the directory using:
    adb shell mkdir /data/fcam