0

I tried to run the last program from the first lecture video of week 1, and I got this error:

clang -ggdb3 -O0 -std=c11 -Wall -Werror    pain.c  -lcs50 -lm -o pain
pain.c:61:1: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
main(void)
^~~~
pain.c:74:33: error: unsequenced modification and access to 'n' [-Werror,-Wunsequenced]
            if ((p+=B)>1){p=2-p;RI(l+j)}
                                ^~~~~~~
pain.c:22:28: note: expanded from macro 'RI'
               =0; n<j; ){ Rl(C   ,r)Rl\
                           ^~~~~~~~~~
pain.c:19:15: note: expanded from macro 'Rl'
             n++[C]         =         t*n/12;
              ^                         ~
pain.c:74:33: error: unsequenced modification and access to 'n' [-Werror,-Wunsequenced]
            if ((p+=B)>1){p=2-p;RI(l+j)}
                                ^~~~~~~
pain.c:22:38: note: expanded from macro 'RI'
               =0; n<j; ){ Rl(C   ,r)Rl\
                                     ^~~
pain.c:19:15: note: expanded from macro 'Rl'
             n++[C]         =         t*n/12;
              ^                         ~
pain.c:74:33: error: unsequenced modification and access to 'n' [-Werror,-Wunsequenced]
            if ((p+=B)>1){p=2-p;RI(l+j)}
                                ^~~~~~~
pain.c:23:25: note: expanded from macro 'RI'
                   (C,g)Rl(C    ,b)++n; }
                        ^~~~~~~~~~~
pain.c:19:15: note: expanded from macro 'Rl'
             n++[C]         =         t*n/12;
              ^                         ~
pain.c:75:44: error: unsequenced modification and access to 'n' [-Werror,-Wunsequenced]
                        else if (p<0){p=-p;RI(l)}
                                           ^~~~~
pain.c:22:28: note: expanded from macro 'RI'
               =0; n<j; ){ Rl(C   ,r)Rl\
                           ^~~~~~~~~~
pain.c:19:15: note: expanded from macro 'Rl'
             n++[C]         =         t*n/12;
              ^                         ~
pain.c:75:44: error: unsequenced modification and access to 'n' [-Werror,-Wunsequenced]
                        else if (p<0){p=-p;RI(l)}
                                           ^~~~~
pain.c:22:38: note: expanded from macro 'RI'
               =0; n<j; ){ Rl(C   ,r)Rl\
                                     ^~~
pain.c:19:15: note: expanded from macro 'Rl'
             n++[C]         =         t*n/12;
              ^                         ~
pain.c:75:44: error: unsequenced modification and access to 'n' [-Werror,-Wunsequenced]
                        else if (p<0){p=-p;RI(l)}
                                           ^~~~~
pain.c:23:25: note: expanded from macro 'RI'
                   (C,g)Rl(C    ,b)++n; }
                        ^~~~~~~~~~~
pain.c:19:15: note: expanded from macro 'Rl'
             n++[C]         =         t*n/12;
              ^                         ~
pain.c:70:27: error: for loop has empty body [-Werror,-Wempty-body]
    }for (;n<j*2;l[n++]=0);
                          ^
pain.c:70:27: note: put the semicolon on a separate line to silence this warning
8 errors generated.
make: *** [pain] Error 1

I copied it from the source code exacly, so what is going on?

(Also I've messed around in c alot on my own in the IDE, and it keeps giving me similar errors about specifiers, or expecting things.)

  • Paste your source code. – Yousuf Ejazi Jun 12 '16 at 4:56
1

Follow the link in the source code to the ioccc page. Follow some of the links to find out what it's all about. It's very cool. Then search the original page for "thad" (it's a winning entry from 2000). There you will find some links. Copy the Makefile to your working directory. Follow the instructions in thadgavin.hint. Make sure your source is named thadgavin.c.

| improve this answer | |

You must log in to answer this question.

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