Testing the installation

To test the product installation and the critical search paths, try building, compiling, and running a couple of simple programs.

For example:

  1. Create the following C and C++ programs:
    [hello.c]
    #include <stdio.h>
    int main(void)
    {
       printf("Hello World!\n");
       return 0;
    }
    [hello.cpp]
    #include <iostream>
    int main()
    {
       std::cout << "Hello World!\n" << std::endl;
       return 0;
    }
  2. Compile the test programs. For example:
    xlc hello.c -o hello
    xlc++ hello.cpp -o hello
    Note: To use shortcuts to the compiler invocation commands, see Creating shortcuts to the XL C/C++ invocation commands. Otherwise, include the full path to the commands to compile the program.
  3. Run the program:
    ./hello

    The expected result is that "Hello World!" is displayed on the screen.

  4. Check the exit code of the program:
    echo $?

    The result is zero.