3.2.5 Compiling the Program and Running the prime Executable

With the four files previously described located in the same working directory, compile the program by using the make command as follows:

# make
gcc -c primelib.c
gcc -c primain.c
gcc primain.o primelib.o -o prime -lm

Running the make command creates an executable named prime, which can be run to find the lowest prime value of the input, as shown in the following two examples:

# ./prime 
Enter a positive target integer to test for prime status: 5099
Square root of 5099 is 71.407280
71 highest value to check as divisor
5099 is a prime number
# ./prime
Enter a positive target integer to test for prime status: 95099
Square root of 95099 is 308.381256
308 highest value to check as divisor
95099 is not prime because there is a factor 61

After compiling the program and running the prime executable, you can practice adding USDT probes to an application, as described in Section 3.3, “Adding USDT Probes to an Application”.