mihirlad55 / polybar-spotify-module

A collection of lightweight programs for use with a Polybar Spotify Module
GNU General Public License v3.0
140 stars 9 forks source link

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

Open Chaugnar opened 1 year ago

Chaugnar commented 1 year ago

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 commented 1 year ago

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