Testing simple programs
To test the product installation and the critical search paths, try building, compiling, and running a couple of simple programs.
For example:
- 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; } - Compile the test programs. For example:
xlc hello.c -o helloxlc++ hello.cpp -o helloNote: 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. - Run the program:
./helloThe expected result is that "Hello World!" is displayed on the screen.
- Check the exit code of the program:
echo $?The result is zero.
Tip:
For an overview of the installation process, see Installation workflow diagram.