complile time error.

I

iceman

Hi All,
I had been compiling a program in gcc and I have been bogged down with
this error.
Any help 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
 
V

Victor Bazarov

iceman said:
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 help 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
 
J

jonnyothan

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 help, but those files are usually really
long.
 
I

iceman

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



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



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.








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



So, which line is 44?

V







No this is not my file but I am using this as header file.
line 44 is
struct iovec
 
I

iceman

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 help, 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);
 
V

Victor Bazarov

iceman said:
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
 
J

James Kanze

Victor said:
iceman wrote:

[...]
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.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top