Closed aurochs-angels closed 4 years ago
@aurochs-angels Thanks a lot for your PR, Let me review.
Related to #78
@aurochs-angels Sorry for late review but I was out of town and was lil busy before that.
@aurochs-angels I am not sure why but I can see errors in src/response.c and src/requests.c while compiling your code. You have not changed those files but I guess your changes in main.c are causing it. Can you please check.
src/requests.c: In function 'main':
src/requests.c:12:7: error: 'str' undeclared (first use in this function)
fgets(str, 1000, stdin);
^
src/requests.c:12:7: note: each undeclared identifier is reported only once for each function it appears in
In file included from main.c:50:0:
src/response.c:21:11: error: 'location' undeclared (first use in this function)
fgets(location, 1000, stdin);
^
src/response.c:33:5: error: 'len' undeclared (first use in this function)
len = strlen(str);
^
src/response.c:34:13: error: 'youtube' undeclared (first use in this function)
strncpy(youtube, str + 19, len);
^
src/response.c:37:5: error: 'start' undeclared (first use in this function)
start = malloc(strlen(youtube) + 1);
^
src/response.c:40:5: error: 'pv' undeclared (first use in this function)
pv = 0; //previous character
^
src/response.c:41:10: error: 'd' undeclared (first use in this function)
for (d = c = 0; youtube[c]; ++c) {
^
src/response.c:41:14: error: 'c' undeclared (first use in this function)
for (d = c = 0; youtube[c]; ++c) {
^
src/response.c:66:42: error: 'HOME_DIR' undeclared (first use in this function)
sprintf(sys_cmd, "%s%s%s", sys_cmd1, HOME_DIR, "media/");
^
src/response.c:70:11: error: 'songs' undeclared (first use in this function)
fgets(songs, 1000, stdin);
^
src/response.c:71:37: error: 'M_P' undeclared (first use in this function)
sprintf(song, "%s %smedia/\%s", M_P, HOME_DIR, songs);
^
src/response.c:77:11: error: 'cal' undeclared (first use in this function)
fgets(cal, 1000, stdin);
^
src/response.c:123:15: error: 'search' undeclared (first use in this function)
fgets(search, 1000, stdin);
@aurochs-angels That's strange though as these are just variable initializations. Please check once
Fixed:
had some declarations in the init_config.c instead of the init_config.h.
New compilation command due to the addition of .c file. "gcc main.c src/init_config.c $(pkg-config --libs --cflags libcurl) -lssl -lcrypto -ljson-c -std=gnu11" This is because init_config.c is not meant to be included in the main.c file, (which would lead the C preprocessor to copy it there in its entirety) instead the linker will link the declaration to the definition using the above command.
Compilation output is nil
@aurochs-angels Thanks, let me check.
@aurochs-angels I can see few errors while compiling your code. Please check.
[ritsharm@ritsharm-ld1 ~/git/pr_config/Virtual-Assistant]$ gcc main.c src/init_config.c $(pkg-config --libs --cflags libcurl) -lssl -lcrypto -ljson-c -std=gnu11
/tmp/ccbL5kBQ.o:(.bss+0x0): multiple definition of `len'
/tmp/ccnL9q84.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
Was caused by a conflicting include. Added an include guard, cleaned up comments, moved vars to where they are actually used. My compile is now clean again, can you please check?
Yes, let me @aurochs-angels
@aurochs-angels Thanks !!
@all-contributors please add @aurochs-angels for code
@ritwik12
I've put up a pull request to add @aurochs-angels! :tada: