Skip to content

‘for’ loop initial declarations are only allowed in C99 mode #30

Description

Hi,

I am not a dev, I have no experience with C and compiler, nor have any clue as to why my compiler would compile with such an old version of C.

I also have no clue on how to specify on the Makefile that I want the following flag : -std=c99.

However I made 3 changes to the C files and got it to work.

spotifyctl.c line 336 :
int i = 1; // Parse commandline options for (i = 1; i < argc; i++) {

spotify-listener.c line 131 :
int p = 0; for (p = 0; p < num_of_paths; p++) {

spotify-listener.c line 136 :
int m = 0; va_start(args, numOfMsgs); for (m = 0; m < numOfMsgs; m++) {

Declaring the variable outside the for loop fixed the issues. type_t would not be understood by my compiler hence I changed those to int. Once done I could compile just fine.

gcc --version gcc (GCC) 7.3.0 make --version GNU Make 3.82 OS : CentOS 7

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions