如何通过makefile抑制GCC错误或抑制特定错误

时间:2018-11-17 01:50:15

标签: linux gcc centos gcc-warning

因此,当运行我的makefile时,我链接了32位和64位库,如果不存在32位,则会给我一个错误,我想知道是否存在一种通过使用makefile上的标志来滤除此错误的方法,或者是否存在一种通过GCC标志抑制此错误的方法。

public class Main {
private static final Scanner stdIn = new Scanner(System.in);

public static void main(String[] args) {

    int totalNumberOfRuns = 0;
    int run = 1;
    boolean theCoin, tempVal = false;

    System.out.println("Welcome to the coin flip analyzer.\n"
            + "How many flips?");
    int numberOfFlips = stdIn.nextInt();
    System.out
            .println("What do you want to seed the random number generator with?");
    long rngSeed = stdIn.nextLong();
    Random rng = new Random(rngSeed);
    int[] runLength = new int[numberOfFlips];

    for (int i = 0; i < numberOfFlips; i++) {
        theCoin = rng.nextBoolean();
        if (theCoin != tempVal) {
            runLength[run - 1]++;
            totalNumberOfRuns++;
            run = 1;
        } else {
            run++;
        }
        if (theCoin) {
            System.out.print("H");
            tempVal = true;
        } else {
            System.out.print("T");
            tempVal = false;
        }
        System.out.print(run + " ");
    }

    System.out.print("...");
    System.out.println();

    System.out
            .println("There were a total of "
                    + totalNumberOfRuns
                    + " distinct runs in the simulation.\nTheir breakdown follows.");

    // run length table header line

    System.out.println("[run length] = # (as percentage of all runs)");

    // your code to display the count and frequency percentage of each run
    // length
    // should follow

    for (int i = 0; i < runLength.length; i++) {
        double percentageFreq = ((double) +(runLength[i])
                / (totalNumberOfRuns) * 100);
        if (runLength[i] > 0) {
            System.out.printf("[%d] = %d (%1.1f%%)%n", i + 1, runLength[i],
                    percentageFreq);
        }
    }
}
}

0 个答案:

没有答案