Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22237

C Program behaves differently if compiled using CLion rather than using gcc directly. Why?

$
0
0

I'm writing a program to play 4 in a row using C90.

I made a UI for the Console using ASCII characters.

If I compile the program using C Lion I get the following output:

Screenshot C Lion Output

If I compile it using gcc main.c and then run ./a.out I get the following result:

Screenshot Terminal Output

So obviously this dot character is sized differently if I compile it using gcc directly.

Has anyone any idea how this could possibly happen?

The code that is responsible for printing the game lines looks like this:

void printGameLine(int line[7]) {
    int i;
    printf("┃");
    for (i = 0; i < 7; ++i) {
        printColor(line[i]);
        line[i] == 0 ? printf("") : printf("⬤ ");
        printColor(0);
        printf("┃");
    }
    printf("\n");
}

The code responsible for the colors looks like this: (If this makes any difference)

/**
 * prints the color
 * @param player -1 First player, 0 neutral, 1 Second Player
 */
void printColor(int player) {
    switch (player) {
        case 1:
            printf("\033[0;31m"); /*red*/
            break;
        case -1:
            printf("\033[0;33m");/*yellow*/
            break;
        default:
            printf("\033[0m");/*neutral*/
            break;
    }
}

Viewing all articles
Browse latest Browse all 22237

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>