Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3977376
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:54:58+00:00 2026-05-20T04:54:58+00:00

HI, guys, I write a small program, named ioprogram.c, with gnu readline library, refering

  • 0

HI, guys,

I write a small program, named “ioprogram.c”, with gnu readline library, refering various documentation on the Internet. however, gcc reports the following errors. what is my problem?

#include <readline/readline.h>
#include <stdio.h>
int main()
{
    char* c = readline("");
    int len = strlen(c);
    for(int i=0; i<len; i++)
    {    
        printf("%c", *(c+i));  
        fflush(stdout);        
    }
    free(c);
}

gcc errors:

In file included from /usr/include/readline/readline.h:37,
                 from ioprogram.c:1:
/usr/include/readline/rltypedefs.h:65: error: expected ‘)’ before ‘*’ token
In file included from ioprogram.c:1:
/usr/include/readline/readline.h:416: error: expected ‘)’ before ‘*’ token
/usr/include/readline/readline.h:532: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/usr/include/readline/readline.h:533: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/usr/include/readline/readline.h:555: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/usr/include/readline/readline.h:823: error: expected specifier-qualifier-list before ‘FILE’
ioprogram.c: In function ‘main’:
ioprogram.c:7: error: ‘for’ loop initial declaration used outside C99 mode

Thanks in advance for any comments.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T04:54:59+00:00Added an answer on May 20, 2026 at 4:54 am

    try compiling with
    gcc ioprogram.c -o ioprogram -lreadline -lncurses

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a small baseball statistics program using data from retrosheet.org, but
guys! I am write a simple program to send a message to a Game
When I do open('output1.txt', 'w').write(Hello guys) A file called output1.txt is immediatly created and
Hey guys I'm not sure how to write this in AS3, but basically I
Could you guys give me an example how to read and write from/to xml
Okay guys, basically the problem I'm having is this. I've been assigned to write
Guys would it be difficult to write coutn which would basically place newline symbol
Guys, I'm trying to write xpath or css to find/click on list element All
Guys, I am trying to write a class in C# that can be used
Hi Guys I don't quite understand the following tutorial question: write a ADT sorted

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.