You are not logged in.

#1 2020-03-18 02:28:51

bwbuhse
Member
Registered: 2020-03-18
Posts: 5

[SOLVED] "unknown type name ‘FILE'" inside of GNU Readline

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

#2 2020-03-18 02:32:33

bwbuhse
Member
Registered: 2020-03-18
Posts: 5

Re: [SOLVED] "unknown type name ‘FILE'" inside of GNU Readline

https://pastebin.com/eL3KxSB9 here's a link to a pastebin of the full output when I try to compile

Offline

#3 2020-03-18 05:33:24

ayekat
Member
Registered: 2011-01-17
Posts: 1,385
Website

Re: [SOLVED] "unknown type name ‘FILE'" inside of GNU Readline

Makefile wrote:
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)


{,META,RE}PKGBUILDSpacman-hacks (includes makemetapkg and remakepkg) │ dotfiles

Offline

#4 2020-03-18 11:51:24

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 23,690
Website

Re: [SOLVED] "unknown type name ‘FILE'" inside of GNU Readline

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

#5 2020-03-18 14:50:53

bwbuhse
Member
Registered: 2020-03-18
Posts: 5

Re: [SOLVED] "unknown type name ‘FILE'" inside of GNU Readline

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

#6 2020-03-18 15:08:38

ayekat
Member
Registered: 2011-01-17
Posts: 1,385
Website

Re: [SOLVED] "unknown type name ‘FILE'" inside of GNU Readline

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 :-/


{,META,RE}PKGBUILDSpacman-hacks (includes makemetapkg and remakepkg) │ dotfiles

Offline

Board footer

Powered by FluxBB