error: expected identifier or '(' before numeric constant - c

error when compiling kernel, this really gives me headache. couldnt figure out whats wrong. multi-line macro definition already escaped by newline.
actual error is
include/linux/mmc/sdio_func.h:169:2: error: expected identifier or '(' before ')' token
header file that trigger the error
/*
* include/linux/mmc/sdio_func.h
*
* Copyright 2007-2008 Pierre Ossman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*/
#ifndef MMC_SDIO_FUNC_H
#define MMC_SDIO_FUNC_H
#include <linux/device.h>
#include <linux/mod_devicetable.h>
#include <linux/mmc/pm.h>
struct mmc_card;
struct sdio_func;
typedef void (sdio_irq_handler_t)(struct sdio_func *);
/*
* Structure used to hold embedded SDIO device data from platform layer
*/
struct sdio_embedded_func {
uint8_t f_class;
uint32_t f_maxblksize;
};
/*
* SDIO function CIS tuple (unknown to the core)
*/
struct sdio_func_tuple {
struct sdio_func_tuple *next;
unsigned char code;
unsigned char size;
unsigned char data[0];
};
/*
* SDIO function devices
*/
struct sdio_func {
struct mmc_card *card; /* the card this device belongs to */
struct device dev; /* the device */
sdio_irq_handler_t *irq_handler; /* IRQ callback */
unsigned int num; /* function number */
unsigned char class; /* standard interface class */
unsigned short vendor; /* vendor id */
unsigned short device; /* device id */
unsigned max_blksize; /* maximum block size */
unsigned cur_blksize; /* current block size */
unsigned enable_timeout; /* max enable timeout in msec */
unsigned int state; /* function state */
#define SDIO_STATE_PRESENT (1<<0) /* present in sysfs */
u8 tmpbuf[4]; /* DMA:able scratch buffer */
unsigned num_info; /* number of info strings */
const char **info; /* info strings */
struct sdio_func_tuple *tuples;
};
#define sdio_func_present(f) ((f)->state & SDIO_STATE_PRESENT)
#define sdio_func_set_present(f) ((f)->state |= SDIO_STATE_PRESENT)
#define sdio_func_id(f) (dev_name(&(f)->dev))
#define sdio_get_drvdata(f) dev_get_drvdata(&(f)->dev)
#define sdio_set_drvdata(f,d) dev_set_drvdata(&(f)->dev, d)
#define dev_to_sdio_func(d) container_of(d, struct sdio_func, dev)
/*
* SDIO function device driver
*/
struct sdio_driver {
char *name;
const struct sdio_device_id *id_table;
int (*probe)(struct sdio_func *, const struct sdio_device_id *);
void (*remove)(struct sdio_func *);
struct device_driver drv;
};
#define to_sdio_driver(d) container_of(d, struct sdio_driver, drv)
/**
* SDIO_DEVICE - macro used to describe a specific SDIO device
* #vend: the 16 bit manufacturer code
* #dev: the 16 bit function id
*
* This macro is used to create a struct sdio_device_id that matches a
* specific device. The class field will be set to SDIO_ANY_ID.
*/
#define SDIO_DEVICE(vend,dev) \
.class = SDIO_ANY_ID, \
.vendor = (vend), .device = (dev)
/**
* SDIO_DEVICE_CLASS - macro used to describe a specific SDIO device class
* #dev_class: the 8 bit standard interface code
*
* This macro is used to create a struct sdio_device_id that matches a
* specific standard SDIO function type. The vendor and device fields will
* be set to SDIO_ANY_ID.
*/
#define SDIO_DEVICE_CLASS(dev_class) \
.class = (dev_class), \
.vendor = SDIO_ANY_ID, .device = SDIO_ANY_ID
extern int sdio_register_driver(struct sdio_driver *);
extern void sdio_unregister_driver(struct sdio_driver *);
/*
* SDIO I/O operations
*/
extern void sdio_claim_host(struct sdio_func *func);
extern void sdio_release_host(struct sdio_func *func);
extern int sdio_enable_func(struct sdio_func *func);
extern int sdio_disable_func(struct sdio_func *func);
extern int sdio_set_block_size(struct sdio_func *func, unsigned blksz);
extern int sdio_claim_irq(struct sdio_func *func, sdio_irq_handler_t *handler);
extern int sdio_release_irq(struct sdio_func *func);
extern unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz);
extern u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret);
extern u8 sdio_readb_ext(struct sdio_func *func, unsigned int addr, int *err_ret,
unsigned in);
extern u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret);
extern u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret);
extern int sdio_memcpy_fromio(struct sdio_func *func, void *dst,
unsigned int addr, int count);
extern int sdio_readsb(struct sdio_func *func, void *dst,
unsigned int addr, int count);
extern void sdio_writeb(struct sdio_func *func, u8 b,
unsigned int addr, int *err_ret);
extern void sdio_writew(struct sdio_func *func, u16 b,
unsigned int addr, int *err_ret);
extern void sdio_writel(struct sdio_func *func, u32 b,
unsigned int addr, int *err_ret);
extern int sdio_memcpy_toio(struct sdio_func *func, unsigned int addr,
void *src, int count);
extern int sdio_writesb(struct sdio_func *func, unsigned int addr,
void *src, int count);
extern unsigned char sdio_f0_readb(struct sdio_func *func,
unsigned int addr, int *err_ret);
extern void sdio_f0_writeb(struct sdio_func *func, unsigned char b,
unsigned int addr, int *err_ret);
extern mmc_pm_flag_t sdio_get_host_pm_caps(struct sdio_func *func);
extern int sdio_set_host_pm_flags(struct sdio_func *func, mmc_pm_flag_t flags);
#endif
line 169 is the last line of code before the #endif, but seeing it i just cant figure out whats wrong with it.

mmc_pm_flag_t type is not known to the compiler. Did you include the correct headers? If yes, check the headers and see if you need to enable some macro.

Related

How do I find declarations/definitions without an IDE?

I've been using the Eclipse IDE for a few years now. When programming in C I'm used to Ctrl+Click on a symbol and Eclipse takes me to the file and line of the symbol's declaration.
Without an IDE, how do I achieve this? I'm using gcc to compile a massive FOSS project with hundreds of header files. Looking though the C files, I see functions that I would like to know more about. Finding the header file that declares said function is a tedious and manual task. Not to mention manual interpretation of macros...
GCC compiles the project and knows what the declarations are and where. Is it possible to generate a human readable index of all symbol declarations along with their filename and position for a given compilation?
Sounds like you're looking for the -aux-info flag; it will write a list of all functions declared or defined in a translation unit (including those in header files) to a specified output file.
Here's a dumb piece of code I wrote for another SO question (don't remember what it was for):
#include <stdio.h>
int main( int argc, const char *argv[] )
{
const unsigned long long lim = 2000000;
unsigned long long nums2lim[lim];
printf( "%zu\n", sizeof nums2lim );
return 0;
}
Compiling it with
gcc -o test -std=c99 -pedantic -Wall -Werror -aux-info=test.aux test.c
yields this output in test.aux:
/* compiled from: . */
/* /usr/include/libio.h:413:NC */ extern int __underflow (_IO_FILE *);
/* /usr/include/libio.h:414:NC */ extern int __uflow (_IO_FILE *);
/* /usr/include/libio.h:415:NC */ extern int __overflow (_IO_FILE *, int);
/* /usr/include/libio.h:416:NC */ extern wint_t __wunderflow (_IO_FILE *);
/* /usr/include/libio.h:417:NC */ extern wint_t __wuflow (_IO_FILE *);
/* /usr/include/libio.h:418:NC */ extern wint_t __woverflow (_IO_FILE *, wint_t);
/* /usr/include/libio.h:451:NC */ extern int _IO_getc (_IO_FILE *);
/* /usr/include/libio.h:452:NC */ extern int _IO_putc (int, _IO_FILE *);
/* /usr/include/libio.h:453:NC */ extern int _IO_feof (_IO_FILE *);
/* /usr/include/libio.h:454:NC */ extern int _IO_ferror (_IO_FILE *);
/* /usr/include/libio.h:456:NC */ extern int _IO_peekc_locked (_IO_FILE *);
/* /usr/include/libio.h:462:NC */ extern void _IO_flockfile (_IO_FILE *);
/* /usr/include/libio.h:463:NC */ extern void _IO_funlockfile (_IO_FILE *);
/* /usr/include/libio.h:464:NC */ extern int _IO_ftrylockfile (_IO_FILE *);
/* /usr/include/libio.h:482:NC */ extern int _IO_vfscanf (_IO_FILE *, const char *, __va_list_tag *, int *);
/* /usr/include/libio.h:484:NC */ extern int _IO_vfprintf (_IO_FILE *, const char *, __va_list_tag *);
/* /usr/include/libio.h:485:NC */ extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t);
/* /usr/include/libio.h:486:NC */ extern size_t _IO_sgetn (_IO_FILE *, void *, size_t);
/* /usr/include/libio.h:488:NC */ extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int);
/* /usr/include/libio.h:489:NC */ extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int);
/* /usr/include/libio.h:491:NC */ extern void _IO_free_backup_area (_IO_FILE *);
/* /usr/include/stdio.h:154:NC */ extern int remove (const char *);
/* /usr/include/stdio.h:156:NC */ extern int rename (const char *, const char *);
/* /usr/include/stdio.h:171:NC */ extern FILE *tmpfile (void);
/* /usr/include/stdio.h:185:NC */ extern char *tmpnam (char *);
/* /usr/include/stdio.h:213:NC */ extern int fclose (FILE *);
/* /usr/include/stdio.h:218:NC */ extern int fflush (FILE *);
/* /usr/include/stdio.h:249:NC */ extern FILE *fopen (const char *, const char *);
/* /usr/include/stdio.h:256:NC */ extern FILE *freopen (const char *, const char *, FILE *);
/* /usr/include/stdio.h:309:NC */ extern void setbuf (FILE *, char *);
/* /usr/include/stdio.h:314:NC */ extern int setvbuf (FILE *, char *, int, size_t);
/* /usr/include/stdio.h:334:NC */ extern int fprintf (FILE *, const char *, ...);
/* /usr/include/stdio.h:339:NC */ extern int printf (const char *, ...);
/* /usr/include/stdio.h:342:NC */ extern int sprintf (char *, const char *, ...);
/* /usr/include/stdio.h:349:NC */ extern int vfprintf (FILE *, const char *, __va_list_tag *);
/* /usr/include/stdio.h:354:NC */ extern int vprintf (const char *, __va_list_tag *);
/* /usr/include/stdio.h:357:NC */ extern int vsprintf (char *, const char *, __va_list_tag *);
/* /usr/include/stdio.h:365:NC */ extern int snprintf (char *, size_t, const char *, ...);
/* /usr/include/stdio.h:369:NC */ extern int vsnprintf (char *, size_t, const char *, __va_list_tag *);
/* /usr/include/stdio.h:406:NC */ extern int fscanf (FILE *, const char *, ...);
/* /usr/include/stdio.h:411:NC */ extern int scanf (const char *, ...);
/* /usr/include/stdio.h:414:NC */ extern int sscanf (const char *, const char *, ...);
/* /usr/include/stdio.h:425:NC */ extern int vfscanf (FILE *, const char *, __va_list_tag *);
/* /usr/include/stdio.h:432:NC */ extern int vscanf (const char *, __va_list_tag *);
/* /usr/include/stdio.h:437:NC */ extern int vsscanf (const char *, const char *, __va_list_tag *);
/* /usr/include/stdio.h:447:NC */ extern int fgetc (FILE *);
/* /usr/include/stdio.h:448:NC */ extern int getc (FILE *);
/* /usr/include/stdio.h:454:NC */ extern int getchar (void);
/* /usr/include/stdio.h:489:NC */ extern int fputc (int, FILE *);
/* /usr/include/stdio.h:490:NC */ extern int putc (int, FILE *);
/* /usr/include/stdio.h:496:NC */ extern int putchar (int);
/* /usr/include/stdio.h:539:NC */ extern char *fgets (char *, int, FILE *);
/* /usr/include/stdio.h:546:NC */ extern char *gets (char *);
/* /usr/include/stdio.h:596:NC */ extern int fputs (const char *, FILE *);
/* /usr/include/stdio.h:602:NC */ extern int puts (const char *);
/* /usr/include/stdio.h:609:NC */ extern int ungetc (int, FILE *);
/* /usr/include/stdio.h:617:NC */ extern size_t fread (void *, size_t, size_t, FILE *);
/* /usr/include/stdio.h:623:NC */ extern size_t fwrite (const void *, size_t, size_t, FILE *);
/* /usr/include/stdio.h:656:NC */ extern int fseek (FILE *, long int, int);
/* /usr/include/stdio.h:661:NC */ extern long int ftell (FILE *);
/* /usr/include/stdio.h:666:NC */ extern void rewind (FILE *);
/* /usr/include/stdio.h:705:NC */ extern int fgetpos (FILE *, fpos_t *);
/* /usr/include/stdio.h:710:NC */ extern int fsetpos (FILE *, const fpos_t *);
/* /usr/include/stdio.h:733:NC */ extern void clearerr (FILE *);
/* /usr/include/stdio.h:735:NC */ extern int feof (FILE *);
/* /usr/include/stdio.h:737:NC */ extern int ferror (FILE *);
/* /usr/include/stdio.h:753:NC */ extern void perror (const char *);
/* test.c:4:NF */ extern int main (int argc, const char **argv); /* (argc, argv) int argc; const char **argv; */
This flag only works for C code, though - it won't give you anything for C++.
A light-weight, hackish approach would be to grep through the header files for the function name. Linux syntax would be something like:
find . -type f -name "*.h" | xargs grep [functionName]
It's what I use for my moderately-sized projects. I can't speak to how well it would scale.

In C header tclPlatDecls.h where is TclPlatStubHooks defined?

I'm porting tcl/tk C headers to D and i've run into a type that doesn't seem to be defined anywhere. Inside the file tclPlatDecls.h there is the following definition:
typedef struct TclPlatStubs {
int magic;
struct TclPlatStubHooks *hooks;
#ifdef __WIN32__ /* WIN */
TCHAR * (*tcl_WinUtfToTChar) (CONST char *str, int len, Tcl_DString *dsPtr); /* 0 */
char * (*tcl_WinTCharToUtf) (CONST TCHAR *str, int len, Tcl_DString *dsPtr); /* 1 */
#endif /* WIN */
#ifdef MAC_OSX_TCL /* MACOSX */
int (*tcl_MacOSXOpenBundleResources) (Tcl_Interp *interp, CONST char *bundleName, int hasResourceFile, int maxPathLen, char *libraryPath); /* 0 */
int (*tcl_MacOSXOpenVersionedBundleResources) (Tcl_Interp *interp, CONST char *bundleName, CONST char *bundleVersion, int hasResourceFile, int maxPathLen, char *libraryPath); /* 1 */
#endif /* MACOSX */
} TclPlatStubs;
I can't find the definition of TclPlatStubHooks. Any idea where this is? I've grep'ed the entire code base and there is no definition anywhere. Even searching on the net yields no results.
For what it's worth, I'll confirm your grep is working, I found only that one reference to it as well, in versions 8.5.15 and 8.4.20.
What may be of interest is that in 8.6.1, the definition changes to void * as seen below.
typedef struct TclPlatStubs {
int magic;
void *hooks;
#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */
TCHAR * (*tcl_WinUtfToTChar) (const char *str, int len, Tcl_DString *dsPtr); /* 0 */
char * (*tcl_WinTCharToUtf) (const TCHAR *str, int len, Tcl_DString *dsPtr); /* 1 */
#endif /* WIN */
#ifdef MAC_OSX_TCL /* MACOSX */
int (*tcl_MacOSXOpenBundleResources) (Tcl_Interp *interp, const char *bundleName, int hasResourceFile, int maxPathLen, char *libraryPath); /* 0 */
int (*tcl_MacOSXOpenVersionedBundleResources) (Tcl_Interp *interp, const char *bundleName, const char *bundleVersion, int hasResourceFile, int maxPathLen, char *libraryPath); /* 1 */
#endif /* MACOSX */
} TclPlatStubs;
Maybe you could get away with treating it as a void *?

error while make runs. Conflicting types and previous declaration

I found an implementation of AES for a project I'm doing.
However when i integrate it I'm getting the following errors during the build.
In file included from ff.h:26:0,
from disp.h:4,
from main.c:14:
aes.h:14:3: error: conflicting types for 'AesCtx'
aes.h:14:3: note: previous declaration of 'AesCtx' was here
aes.h:28:5: error: conflicting types for 'AesCtxIni'
aes.h:28:5: note: previous declaration of 'AesCtxIni' was here
aes.h:29:5: error: conflicting types for 'AesEncrypt'
aes.h:29:5: note: previous declaration of 'AesEncrypt' was here
aes.h:30:5: error: conflicting types for 'AesDecrypt'
aes.h:30:5: note: previous declaration of 'AesDecrypt' was here
The header file itself is:
// AES context structure
typedef struct {
unsigned int Ek[60];
unsigned int Dk[60];
unsigned int Iv[4];
unsigned char Nr;
unsigned char Mode;
} AesCtx;
// key length in bytes
#define KEY128 16
#define KEY192 24
#define KEY256 32
// block size in bytes
#define BLOCKSZ 16
// mode
#define EBC 0
#define CBC 1
// AES API function prototype
int AesCtxIni(AesCtx *pCtx, unsigned char *pIV, unsigned char *pKey, unsigned int KeyLen, unsigned char Mode);
int AesEncrypt(AesCtx *pCtx, unsigned char *pData, unsigned char *pCipher, unsigned int DataLen);
int AesDecrypt(AesCtx *pCtx, unsigned char *pCipher, unsigned char *pData, unsigned int CipherLen);
and then the respective C file uses.
int AesCtxIni(AesCtx *pCtx, unsigned char *pIV, unsigned char *pKey, unsigned int KeyLen, unsigned char Mode)
{
// Cut out code for brevity
}
int AesEncrypt(AesCtx *pCtx, unsigned char *pData, unsigned char *pCipher, unsigned int DataLen)
{
// Cut out code for brevity
}
int AesDecrypt(AesCtx *pCtx, unsigned char *pCipher, unsigned char *pData, unsigned int CipherLen)
{
// Cut out code for brevity
}
I know these errors usually occur because either the function hasn't been pre-declared or because it's slightly different to it's declaration, but I can't see a difference.
Any ideas?
What compiler are you using? My best guess that it's trying to say aes.h is being #included twice. Try adding header guards at the beginning and end of the aes.h:
#ifndef AES_H_
#define AES_H_
typedef struct {
...
int AesDecrypt(AesCtx *pCtx, unsigned char *pCipher, unsigned char *pData, unsigned int CipherLen);
#endif /* !AES_H_ */

RPC - conflicting types error

I have the following .x file called paper.x . When I create a server in rpc in order to call the function the error below occurs
paperserverproc.c:23:5: error: conflicting types for ‘add_procedure_1_svc’
paper.h:46:15: note: previous declaration of ‘add_procedure_1_svc’ was here
#include <limits.h>
struct paper_saved{
char author_name[CHAR_MAX];
char paper_title[CHAR_MAX];
int paper_id;
char paper_file_name[CHAR_MAX];
char paper_content[CHAR_MAX];
};
struct paper_info_saved{
char author_name[CHAR_MAX];
char paper_title[CHAR_MAX];
int paper_id;
char paper_file_name[CHAR_MAX];
};
struct list_papers{
paper_saved paper;
struct list_papers *next;
};
program PAPER_PROGRAM
{
version PAPER_VERSION
{
int ADD_PROCEDURE(paper_saved) = 1; /* Procedure nb */
void LIST_PROCEDURE(void)=2;
paper_info_saved INFO_PROCEDURE(int)=3;
paper_saved FETCH_PROCEDURE(int)=4;
void REMOVE_PROCEDURE(int)=5;
} = 1; /* Version nb */
} = 0x20001234; /* Program number */
I call the procedure with this way and the line 23 is the line when I declare the function as below
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "paper.h"
#include <ctype.h>
#include <limits.h>
.......
int add_procedure_1_svc(paper_saved *paper_pointer, struct svc_req *rqstp)
This is the paper.h file generated by rpcgen and I dont know what's the problem in line 46 that it mentions
/*
* Please do not edit this file.
* It was generated using rpcgen.
*/
#ifndef _PAPER_H_RPCGEN
#define _PAPER_H_RPCGEN
#include <rpc/rpc.h>
#ifdef __cplusplus
extern "C" {
#endif
struct paper_saved {
char author_name[127];
char paper_title[127];
int paper_id;
char paper_file_name[127];
char paper_content[127];
};
typedef struct paper_saved paper_saved;
struct paper_info_saved {
char author_name[127];
char paper_title[127];
int paper_id;
char paper_file_name[127];
};
typedef struct paper_info_saved paper_info_saved;
struct list_papers {
paper_saved paper;
struct list_papers *next;
};
typedef struct list_papers list_papers;
#define PAPER_PROGRAM 0x20001234
#define PAPER_VERSION 1
#if defined(__STDC__) || defined(__cplusplus)
#define ADD_PROCEDURE 1
extern int * add_procedure_1(paper_saved *, CLIENT *);
extern int * add_procedure_1_svc(paper_saved *, struct svc_req *);
#define LIST_PROCEDURE 2
extern void * list_procedure_1(void *, CLIENT *);
extern void * list_procedure_1_svc(void *, struct svc_req *);
#define INFO_PROCEDURE 3
extern paper_info_saved * info_procedure_1(int *, CLIENT *);
extern paper_info_saved * info_procedure_1_svc(int *, struct svc_req *);
#define FETCH_PROCEDURE 4
extern paper_saved * fetch_procedure_1(int *, CLIENT *);
extern paper_saved * fetch_procedure_1_svc(int *, struct svc_req *);
#define REMOVE_PROCEDURE 5
extern void * remove_procedure_1(int *, CLIENT *);
extern void * remove_procedure_1_svc(int *, struct svc_req *);
extern int paper_program_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
#else /* K&R C */
#define ADD_PROCEDURE 1
extern int * add_procedure_1();
extern int * add_procedure_1_svc();
#define LIST_PROCEDURE 2
extern void * list_procedure_1();
extern void * list_procedure_1_svc();
#define INFO_PROCEDURE 3
extern paper_info_saved * info_procedure_1();
extern paper_info_saved * info_procedure_1_svc();
#define FETCH_PROCEDURE 4
extern paper_saved * fetch_procedure_1();
extern paper_saved * fetch_procedure_1_svc();
#define REMOVE_PROCEDURE 5
extern void * remove_procedure_1();
extern void * remove_procedure_1_svc();
extern int paper_program_1_freeresult ();
#endif /* K&R C */
/* the xdr functions */
#if defined(__STDC__) || defined(__cplusplus)
extern bool_t xdr_paper_saved (XDR *, paper_saved*);
extern bool_t xdr_paper_info_saved (XDR *, paper_info_saved*);
extern bool_t xdr_list_papers (XDR *, list_papers*);
#else /* K&R C */
extern bool_t xdr_paper_saved ();
extern bool_t xdr_paper_info_saved ();
extern bool_t xdr_list_papers ();
#endif /* K&R C */
#ifdef __cplusplus
}
#endif
#endif /* !_PAPER_H_RPCGEN */
So the correct one .h file is
#include <limits.h>
struct paper_saved{
char author_name[CHAR_MAX];
char paper_title[CHAR_MAX];
int paper_id;
char paper_file_name[CHAR_MAX];
char paper_content[CHAR_MAX];
};
struct paper_info_saved{
char author_name[CHAR_MAX];
char paper_title[CHAR_MAX];
int paper_id;
char paper_file_name[CHAR_MAX];
};
struct list_papers{
paper_saved paper;
struct list_papers *next;
};
typedef int p_id;
program PAPER_PROGRAM
{
version PAPER_VERSION
{
p_id ADD_PROCEDURE(paper_saved) = 1; /* Procedure nb */
void LIST_PROCEDURE(void)=2;
paper_info_saved INFO_PROCEDURE(int)=3;
paper_saved FETCH_PROCEDURE(int)=4;
void REMOVE_PROCEDURE(int)=5;
} = 1; /* Version nb */
} = 0x20001234; /* Program number */
The function is declared as returning int:
int add_procedure_1_svc(paper_saved *paper_pointer, struct svc_req *rqstp)
but the extern as returning int*
extern int * add_procedure_1_svc(paper_saved *, struct svc_req *);
one of them must be wrong.
What does line 46 of file paper.h have? . Check the paper.h file on the line 46 to see if the function signature is same.Is it auto generated by rpcgen ?

Errors in header file with function taking structs

What's wrong with this header? Gcc throws out:
libmmbox.h:7:29: error: expected ‘)’ before ‘*’ token
libmmbox.h:8:27: error: expected ‘)’ before ‘*’ token
Here's my code:
#ifndef __LIBMMBOX_H__
#define __LIBMMBOX_H__
int mmbox_connect(char *username);
int mmbox_login(int token, char *password);
int mmbox_quit();
int mmbox_stat(mmbox_stat_t *result);
int mmbox_list(mmbox_mail **l, int *num_msg);
int mmbox_send(char *dest, char *obj, void *buf, size_t size);
int mmbox_rcv(int id, void *buf, size_t size);
int mmbox_delete(int id);
int mmbox_resume(int id);
typedef struct
{
char *user;
int used_space;
int free_space;
int num_msg;
} mmbox_stat_t;
typedef struct
{
char *sender, *recipient; /
char *obj, *date;
char flags;
size_t size;
} mmbox_mail;
#endif
mmbox_stat_t struct is declared after it is used into a function signature. So the compiler doesn't still know this type when you declare:
int mmbox_stat(mmbox_stat_t *result);
Put your function prototypes after data structures definition.

Resources