You are not logged in.
I just switched to Arch today and am trying to make sure I have everything configured fairly well.
One thing I'm trying to do is ensure that I can compile my old projects, but I've run into the issue in this ( https://github.com/bwbuhse/ee461s_project_1 ) project that readline doesn't include <stdio.h>
Any ideas on what I'm doing wrong? This compiled fine on my old Mint installation.
Last edited by bwbuhse (2020-03-18 14:51:10)
Offline
https://pastebin.com/eL3KxSB9 here's a link to a pastebin of the full output when I try to compile
Offline
gcc -g -c main.c
To compile with readline, you'll need additional flags. Use pkgconf for determining the required compilation flags, i.e.:
pkgconf --cflags readline
--edit: Same for the linking step. `-lreadline` is correct, but I wouldn't hardcode it, but also use the output of `pkgconf --libs` there.
Last edited by ayekat (2020-03-18 05:34:43)
Offline
Ayekat, that doesn't help. The OP's concern is that readline itself uses FILE but does not include the header in which it is defined. This does seem wrong to me - though readline's man page shows that one must include stdio.h themselves to use readline: so it is documented.
But bwbuhse, you also use printf in your code, so you definitely need to include stdio.h. I can only assume that what ever distro/compiler you previously used just included common things for you.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Would you look at that, Trilby, you're right. I'd tried including it before but I guess I needed to include it above where I included readline. Thanks!
Offline
Ah yes, I should've tested it myself, sorry for the noise.
I had assumed that the additional `-D_…` parameters would cause the readline header to include the right headers (or rather define the right macros) to eventually get all the required definitions, but… nope.
It's indeed weird that including the required header files is left to the programmer… but I guess if it's documented, one cannot really complain too much :-/
Offline