Hi. I'm trying to compile some software from source, and I'm
getting an error I can't figure out. The error in question is
key_events.h:38 : field `id' has incomplete type
and the lines corresponding to the error are:
struct kb_event_id_s
{
char name[16];
int number;
};
typedef struct kb_event_id_s kb_event_id_t;
struct kb_event_map_s {
char prefix[8];
const kb_event_id_t id[];
};
typedef struct kb_event_map_s kb_event_map_t;
I can't spot the error. Can someone give me a hand?
Thanks!
kj
--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded. 5 12332
kj <so***@987jk.co m.invalid> wrote: Hi. I'm trying to compile some software from source, and I'm getting an error I can't figure out. The error in question is
key_events.h:38 : field `id' has incomplete type
struct kb_event_map_s { char prefix[8]; const kb_event_id_t id[]; };
I can't spot the error.
The error is precisely what the error message told you: the field called
id, in the struct called kb_event_map_s, has incomplete type. Variable-
length arrays are valid only in C99, and you're probably using a C89
compiler, so you can't do this. You must give id some specific size. If
you need a variable-length array, you can either find a C99 compiler, or
make id a pointer and use malloc().
Richard
kj wrote: Hi. I'm trying to compile some software from source, and I'm getting an error I can't figure out. The error in question is
key_events.h:38 : field `id' has incomplete type
and the lines corresponding to the error are:
struct kb_event_id_s { char name[16]; int number; }; typedef struct kb_event_id_s kb_event_id_t;
struct kb_event_map_s { char prefix[8]; const kb_event_id_t id[];
^^
The error is due to the fact that you have not specified
the number of elements that id can/should hold. The compiler is at a
loss.
Either initialise the kb_event_id_t array with specific
objects or specify some value between [],
that is evaluated to some integer at compile time. Of course there
are VLA's in C99 but the above should be good enough to get started. }; typedef struct kb_event_map_s kb_event_map_t;
I can't spot the error. Can someone give me a hand?
Thanks!
kj
-- NOTE: In my address everything before the first period is backwards; and the last period, and everything after it, should be discarded.
> key_events.h:38 : field `id' has incomplete type struct kb_event_map_s { char prefix[8]; const kb_event_id_t id[]; };
I can't spot the error. Can someone give me a hand?
Your compiler doesn't support C99's flexible array members. Some
pre-C99 compilers implemented this as id[0], if that fails you can
always try the "struct hack" trick (not legal but works well in
practice).
On 6 Jul 2005 05:55:17 -0700, "Suman" <sk*****@gmail. com> wrote: kj wrote:
<snip> key_events.h:38 : field `id' has incomplete type
<snip> struct kb_event_map_s { char prefix[8]; const kb_event_id_t id[]; ^^ The error is due to the fact that you have not specified the number of elements that id can/should hold. The compiler is at a loss.
For a C90 compiler, as others have noted, true.
Either initialise the kb_event_id_t array with specific objects or specify some value between [], that is evaluated to some integer at compile time. Of course there are VLA's in C99 but the above should be good enough to get started.
All three of these are only applicable to a 'top-level' object, not a
field in a struct which is obviously the case here and as the OP's
quoted error message confirms.
- David.Thompson1 at worldnet.att.ne t
Dave Thompson wrote:
[snip]... Either initialise the kb_event_id_t array with specific objects or specify some value between [], that is evaluated to some integer at compile time. Of course there are VLA's in C99 but the above should be good enough to get started.
All three of these are only applicable to a 'top-level' object, not a field in a struct which is obviously the case here and as the OP's quoted error message confirms.
My mistake. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Lou Pecora |
last post by:
g++ compiler error question.
I have a container C whose constructor takes a class B that is inherited
from an abstract class A. So I have the line of code:
B binstance;
C cinstance(binstance);
The compiler gives the error,
|
by: sling blade |
last post by:
Hi,
For some reason asp.net will not let me publish a new Webpage.
I am able to create a new page however when I set it as the start page
and hit run, I recieve "Could not load type" error message. The first
line of the html is highlighted.
I have tried to create a second page with the same results. The second
page was blank I had not written any code for it.
|
by: hamstak |
last post by:
While attempting to perform a build on an .aspx page from within VS
2005 I receive the "Could not load type" error pertaining to the class
representing the page. The class is derived from a custom base class
(which itself is derived from System.Web.UI.Page). This custom base
class has been used in other projects successfully. The Inherits
attribute of the @Page directive is properly assigned and the
application root is properly...
|
by: John Sasso |
last post by:
In my Yacc .y file I defined:
%union {
int value;
struct Symbol Sym;
}
The Symbol struct I defined in a header file I #included in the Prologue
section of the .y file as:
|
by: Ian825 |
last post by:
I need help writing a function for a program that is based upon the various operations of a matrix and I keep getting a "non-aggregate type" error. My guess is that I need to dereference my pointers, but I'm not sure. Please help.
The code:
void equate(matrix *A, matrix *B)
{
int i, j;
assert(A.row_dim == B.col_dim && A.col_dim == B.col_dim);
for(i=0; i < A.row_dim; i++)
for(j=0; j < A.col_dim; j++)
| |
by: magyar.laszlo |
last post by:
Hi !
I have an activex .net dll in a webpage. This activeX is trying to
connect to an LDAP server using System.DirectoryServices.
Unfortunatelly it gets always "request for the permission of type"
error.
If I give full trust at the .net config tool it is working fine.
Is there any way to avoid this client .net confoguration?
|
by: eros |
last post by:
ALTER TABLE public.postcodes
ALTER COLUMN machi
TYPE varchar(100);
Error: ERROR: syntax error at or near "TYPE";
Error while executing the query (State:42601, Native Code: 7)
I am using WinSQL, Windows XP SP2 Japanese Version, PostgreSQL 8.x.
I want to alter my machi field from varchar(30) to varchar(100) TYPE.
This is my CREATE TABLE script:
|
by: unclefester |
last post by:
I have two classes: Test1 and Test2. Test1 has a field of data type Test2, & vice versa. I need some help in avoiding the incomplete type error ("Error: field has incomplete type").
Test1.h
#ifndef _TEST1_
#define _TEST1_
#include "Test2.h"
using namespace std;
|
by: tejesh |
last post by:
I am trying to compile the following code
int backend_sm_run(struct interface_data *ctx)
{
xsup_assert((ctx != NULL), "ctx != NULL", TRUE);
xsup_assert((ctx->statemachine != NULL), "ctx->statemachine != NULL",
TRUE);
backend_sm_check_globals(check);
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |