PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.cplus > complile time error.
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
complile time error.

Réponse
 
LinkBack Outils de la discussion
Vieux 15/01/2008, 00h41   #1
iceman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut complile time error.

Hi All,
I had been compiling a program in gcc and I have been bogged down with
this error.
Any is greatly appreciated.


uio_bits.h:44: error: expected constructor, destructor, or type
conversion before 'struct'

the uio_bit.h header file contains:


#ifndef _BITS_UIO_H
#define _BITS_UIO_H 1
#include <stdlib.h>
#include <sys/types.h>


/* We should normally use the Linux kernel header file to define this
type and macros but this calls for trouble because of the header
includes other kernel headers. */

/* Size of object which can be written atomically.

This macro has different values in different kernel versions. The
latest versions of the kernel use 1024 and this is good choice.
Since
the C library implementation of readv/writev is able to emulate the
functionality even if the currently running kernel does not support
this large value the readv/writev call will not fail because of
this. */
#define UIO_MAXIOV 1024


/* Structure for scatter/gather I/O. */
struct iovec
{
void *iov_base; /* Pointer to data. */
size_t iov_len; /* Length of data. */
};

#endif
  Réponse avec citation
Vieux 15/01/2008, 02h09   #2
Victor Bazarov
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: complile time error.

iceman wrote:
> I had been compiling a program in gcc


Maybe you should try g++... :-) Just kidding.

> and I have been bogged down with
> this error.
> Any is greatly appreciated.
>
>
> uio_bits.h:44: error: expected constructor, destructor, or type
> conversion before 'struct'


You noticed "_before_ struct"? Have you tried outputting the
result of preprocessing your file? Do.

> the uio_bit.h header file contains:
>
>
> #ifndef _BITS_UIO_H
> #define _BITS_UIO_H 1


Is this your file? If it's yours, the use of an identifier that
begins with an underscore and a capital letter is illegal - that
name is reserved by the implementation.

> #include <stdlib.h>
> #include <sys/types.h>
>
>
> /* We should normally use the Linux kernel header file to define this
> type and macros but this calls for trouble because of the header
> includes other kernel headers. */
>
> /* Size of object which can be written atomically.
>
> This macro has different values in different kernel versions. The
> latest versions of the kernel use 1024 and this is good choice.
> Since
> the C library implementation of readv/writev is able to emulate the
> functionality even if the currently running kernel does not support
> this large value the readv/writev call will not fail because of
> this. */
> #define UIO_MAXIOV 1024
>
>
> /* Structure for scatter/gather I/O. */
> struct iovec
> {
> void *iov_base; /* Pointer to data. */
> size_t iov_len; /* Length of data. */


'size_t' is actually 'std::size_t' last time I looked, unless it's
typedef'ed or brought in with 'using'.

> };
>
> #endif


So, which line is 44?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


  Réponse avec citation
Vieux 15/01/2008, 03h36   #3
jonnyothan@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: complile time error.

I'm betting the error is in whatever .c/.cpp file that is #include-ing
this header (immediately before it is included). Looking at
preprocessor output would , but those files are usually really
long.
  Réponse avec citation
Vieux 15/01/2008, 06h35   #4
iceman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: complile time error.

On Jan 15, 1:09 pm, "Victor Bazarov" <v.Abaza...@comAcast.net> wrote:
> iceman wrote:
> > I had been compiling a program in gcc

>
> Maybe you should try g++... :-) Just kidding.
>
> > and I have been bogged down with
> > this error.
> > Any is greatly appreciated.

>
> > uio_bits.h:44: error: expected constructor, destructor, or type
> > conversion before 'struct'

>
> You noticed "_before_ struct"? Have you tried outputting the
> result of preprocessing your file? Do.
>
> > the uio_bit.h header file contains:

>
> > #ifndef _BITS_UIO_H
> > #define _BITS_UIO_H 1

>
> Is this your file? If it's yours, the use of an identifier that
> begins with an underscore and a capital letter is illegal - that
> name is reserved by the implementation.
>
>
>
> > #include <stdlib.h>
> > #include <sys/types.h>

>
> > /* We should normally use the Linux kernel header file to define this
> > type and macros but this calls for trouble because of the header
> > includes other kernel headers. */

>
> > /* Size of object which can be written atomically.

>
> > This macro has different values in different kernel versions. The
> > latest versions of the kernel use 1024 and this is good choice.
> > Since
> > the C library implementation of readv/writev is able to emulate the
> > functionality even if the currently running kernel does not support
> > this large value the readv/writev call will not fail because of
> > this. */
> > #define UIO_MAXIOV 1024

>
> > /* Structure for scatter/gather I/O. */
> > struct iovec
> > {
> > void *iov_base; /* Pointer to data. */
> > size_t iov_len; /* Length of data. */

>
> 'size_t' is actually 'std::size_t' last time I looked, unless it's
> typedef'ed or brought in with 'using'.
>
> > };

>
> > #endif

>
> So, which line is 44?
>
> V
> --
> Please remove capital 'A's when replying by e-mail
> I do not respond to top-posted replies, please don't ask








No this is not my file but I am using this as header file.
line 44 is
struct iovec
  Réponse avec citation
Vieux 15/01/2008, 06h55   #5
iceman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: complile time error.

On Jan 15, 2:36 pm, jonnyot...@gmail.com wrote:
> I'm betting the error is in whatever .c/.cpp file that is #include-ing
> this header (immediately before it is included). Looking at
> preprocessor output would , but those files are usually really
> long.







I have pasted a part of the preprocessor output.
Everything seems to be ok.




# 1 "/home/jegan/Desktop/downloads/control_plane/uio.h" 1
# 28 "/home/jegan/Desktop/downloads/control_plane/uio.h"
# 1 "/home/jegan/Desktop/downloads/control_plane/uio_bits.h" 1
# 44 "/home/jegan/Desktop/downloads/control_plane/uio_bits.h"
struct iovec
{
void *iov_base;
size_t iov_len;
};
# 29 "/home/jegan/Desktop/downloads/control_plane/uio.h" 2
# 42 "/home/jegan/Desktop/downloads/control_plane/uio.h"
extern ssize_t readv (int __fd, __const struct iovec *__iovec, int
__count);
# 52 "/home/jegan/Desktop/downloads/control_plane/uio.h"
extern ssize_t writev (int __fd, __const struct iovec *__iovec, int
__count);



The uio.h is the file which includes uio_bits.h.It contains

28 #include <uio_bits.h>


/* Read data from file descriptor FD, and put the result in the
buffers described by IOVEC, which is a vector of COUNT `struct
iovec's.
The buffers are filled in the order specified.
Operates just like `read' (see <unistd.h>) except that data are
put in IOVEC instead of a contiguous buffer.

This function is a cancellation point and therefore not marked with
__THROW. */



42 extern ssize_t readv (int __fd, __const struct iovec *__iovec, int
__count);

/* Write data pointed by the buffers described by IOVEC, which
is a vector of COUNT `struct iovec's, to file descriptor FD.
The data is written in the order specified.
Operates just like `write' (see <unistd.h>) except that the data
are taken from IOVEC instead of a contiguous buffer.

This function is a cancellation point and therefore not marked with
__THROW. */
extern ssize_t writev (int __fd, __const struct iovec *__iovec, int
__count);


  Réponse avec citation
Vieux 15/01/2008, 14h10   #6
Victor Bazarov
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: complile time error.

iceman wrote:
> On Jan 15, 2:36 pm, jonnyot...@gmail.com wrote:
>> I'm betting the error is in whatever .c/.cpp file that is
>> #include-ing this header (immediately before it is included).
>> Looking at preprocessor output would , but those files are
>> usually really long.

>
>
>
>
>
>
> I have pasted a part of the preprocessor output.
> Everything seems to be ok.
>
>
>
>
> # 1 "/home/jegan/Desktop/downloads/control_plane/uio.h" 1
> # 28 "/home/jegan/Desktop/downloads/control_plane/uio.h"
> # 1 "/home/jegan/Desktop/downloads/control_plane/uio_bits.h" 1
> # 44 "/home/jegan/Desktop/downloads/control_plane/uio_bits.h"
> struct iovec
> {
> void *iov_base;
> size_t iov_len;


Unless you omitted some parts of the preprocessor output, here is
your error: 'size_t' is not defined.

> };
> # 29 "/home/jegan/Desktop/downloads/control_plane/uio.h" 2
> # 42 "/home/jegan/Desktop/downloads/control_plane/uio.h"
> extern ssize_t readv (int __fd, __const struct iovec *__iovec, int
> __count);
> # 52 "/home/jegan/Desktop/downloads/control_plane/uio.h"
> extern ssize_t writev (int __fd, __const struct iovec *__iovec, int
> __count);
>
>
>
> The uio.h is the file which includes uio_bits.h.It contains
>
> 28 #include <uio_bits.h>
>
>
> /* Read data from file descriptor FD, and put the result in the
> buffers described by IOVEC, which is a vector of COUNT `struct
> iovec's.
> The buffers are filled in the order specified.
> Operates just like `read' (see <unistd.h>) except that data are
> put in IOVEC instead of a contiguous buffer.
>
> This function is a cancellation point and therefore not marked with
> __THROW. */
>
>
>
> 42 extern ssize_t readv (int __fd, __const struct iovec *__iovec, int
> __count);
>
> /* Write data pointed by the buffers described by IOVEC, which
> is a vector of COUNT `struct iovec's, to file descriptor FD.
> The data is written in the order specified.
> Operates just like `write' (see <unistd.h>) except that the data
> are taken from IOVEC instead of a contiguous buffer.
>
> This function is a cancellation point and therefore not marked with
> __THROW. */
> extern ssize_t writev (int __fd, __const struct iovec *__iovec, int


WTH is 'ssize_t'?

> __count);


V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


  Réponse avec citation
Vieux 15/01/2008, 21h48   #7
James Kanze
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: complile time error.

Victor Bazarov wrote:
> iceman wrote:


[...]
> > extern ssize_t writev (int __fd, __const struct iovec *__iovec, int


> WTH is 'ssize_t'?


Something else defined in the parts of the pre-processor
expansion he didn't show. (FWIW, it's a typedef defined by
Posix. *NOT* on topic here, of course, unless it's related to
some other real C++ problem.)

--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 11h35.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,18555 seconds with 15 queries