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 8703991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:59:20+00:00 2026-06-13T02:59:20+00:00

This seems like an easy problem to fix, but i’m doing something wrong. I’ve

  • 0

This seems like an easy problem to fix, but i’m doing something wrong. I’ve been through all the similar threads and didn’t find anything that solved my problem, so any help would be appreciated!

Basically: C program, and i’m trying to create an array of bufferevents.

#include <event2/listener.h>
#include <event2/bufferevent.h>
#include <event2/buffer.h>

extern struct bufferevent bev[8];

//Then, my accept functions -- well, one of them...
static void accept1(struct evconnlistener *listener,
    evutil_socket_t fd, struct sockaddr *address, int socklen,
    void *ctx) {
    /* A new connection was received on this port */
    struct event_base *base = evconnlistener_get_base(listener);
    bev[0] = bufferevent_socket_new(base, fd, BEV_OPT_CLOSE_ON_FREE);

    /* Callback for when (*bufevent, data READ, data WRITTEN, event OCCURRED, *void) */
    bufferevent_setcb(bev[0], read1, NULL, echo_event_cb, NULL);
} 

When i attempt to compile (WITH -levent, i might add) i get this error:

src/mix/mix1.c:57:34: error: array type has incomplete element type

Any ideas? 🙁

Note: I am defining the bufferevents outside of main to make them accessible everywhere in my code without passing them. I have other #define’s in the area, so i’m sure it’s something to do with the way i’m building them??

  • 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-06-13T02:59:21+00:00Added an answer on June 13, 2026 at 2:59 am

    struct bufferevent is only declared as an incomplete type in libevent’s public headers; its contents are hidden to users of the public API. All the libevent functions that operate on bufferevents take a pointer to a bufferevent, so what you want here is

    struct bufferevent *bev[8];
    

    Note further that you do NOT want to put extern on that declaration or you’ll get an undefined symbol error at link time. If it is only ever referred to in that file, you should use static instead. Otherwise there should be a declaration with extern in one of your application’s header files in addition to the extern-less declaration in the file you showed.

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

Sidebar

Related Questions

This seems like it should be something very easy to do, but every time
This seems like a fairly simple problem to me but I have been having
This seems like it should be an easy fix, but after searching for hours
This seems like an easy problem to solve, but it's kickin my ass. The
This seems like an odd problem. Maybe it's also the wrong approach. But I
This seems like such an easy problem, but I can't seem to find a
This seems like an extremely easy problem but alas I cannot figure it out
This seems like it should be an easy fix, but so far a solution
This seems like an easy enough issue but I can't seem to find the
This seems like it should be easy, but I can't quite find an explanation

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.