I type the same code as David, yet I get an unused window error and he doesn't. My code follows, and you can just as easily compare with his.

#include <spl/gevents.h>
#include <spl/gwindow.h>

int main(void)
GWindow window = newGWindow(320, 240);

while (true)
    GEvent event = getNextEvent(MOUSE_EVENT);

    if (event != NULL)
        if (getEventType(event) == MOUSE_CLICKED)
            printf("%.0f, %.0f", getX(event), getY(event));



Actually, it's not really anything to do with the code you've typed in. Its the clang compiler complaining.

The breakout.c program would also suffer the same fate if clang was not told to suppress the error in the Makefile definition file.

For breakout it contains the following option: -Wno-unused-variable

-W is the command line option relating to a Warning

no is used to suppress/ignore this warning

-unused-variable is the warning to suppress/ignore.

If you create your .c file in the same directory as breakout, simply edit Makefile to include the following lines:

click: click.c Makefile
    clang -ggdb3 -O0 -std=c99 -Wall -Werror -Wno-unused-variable -o click click.c -lcs -lm

Then try to compile & it will work. Alternatively, run clang from the command line.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .