|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
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); |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
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 |
|
![]() |
| Outils de la discussion | |
|
|