Re: Compilation Errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2003-05-29 at 10:49, S kris wrote:
> Hi,
> 
> I am getting the following two compilation errors. Please clarify for 
> resolving this.
> 
> * In file test.h
> 
>    typedef struct {
>                int x;
>                char y;
>    }simple;
> 
>    & in another header file test1.h, which is also included in file test.c, 
> the following statement is used which gives the 'parse error before token 
> *'.
> 
>    func( simple *i);
> 
> *In file test.h
> 
>   #define CONST const
> 
> & in another header file test1.h, which is also included in file test.c, the 
> following statement is used which again gives the parse error.
> 
>     func( CONST char *c);
> 
> Errors are appeared even after the files are compiled with appropriate 
> include paths. What may be the reason for this?
> 

This works for me.  I did have to fix up the prototypes
a bit, to get rid of warnings. I suspect your #include lines
are in the wrong order.  You also had two different prototypes
for the function 'func'.

$ more test*
::::::::::::::
test.c
::::::::::::::
#include "test.h"
#include "test1.h"

int main() {return 0;}
::::::::::::::
test.h
::::::::::::::
 typedef struct {
         int x;
         char y;
 }simple;

#define CONST const
::::::::::::::
test1.h
::::::::::::::
int func( simple *i);
int func2( CONST char *c);

$ 
$ gcc -Wall test.c
$ 

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux