Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Chaugnar opened this issue Oct 24, 2022 · 1 comment
Open

Comments

@Chaugnar
Copy link

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

@Chaugnar
Copy link
Author

It is most likely due to my dumb """ fixes """, but here is the now error I run into :

`± |master U:2 ✗| → sudo systemctl status spotify-listener.service
● spotify-listener.service - A program that monitors Spotify DBus signals and communicates with polybar over IPC to control the polybar spotify modules.
Loaded: loaded (/usr/lib/systemd/system/spotify-listener.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2022-10-24 15:08:51 CEST; 14s ago
Process: 25241 ExecStart=/usr/bin/spotify-listener (code=exited, status=1/FAILURE)
Main PID: 25241 (code=exited, status=1/FAILURE)

Oct 24 15:08:50 WL2100198.evs.tv systemd[1]: Started A program that monitors Spotify DBus signals and communicates with polybar over IPC to control the polybar spotify modules..
Oct 24 15:08:50 WL2100198.evs.tv spotify-listener[25241]: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Oct 24 15:08:51 WL2100198.evs.tv systemd[1]: spotify-listener.service: main process exited, code=exited, status=1/FAILURE
Oct 24 15:08:51 WL2100198.evs.tv systemd[1]: Unit spotify-listener.service entered failed state.
Oct 24 15:08:51 WL2100198.evs.tv systemd[1]: spotify-listener.service failed.
`

I guess that the error says that X11 would not be online, but it is

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant