-   Programming (
-   -   conflicting types error in parser.c (

snecklifter 02-27-2005 03:44 PM

conflicting types error in parser.c
Hi folks,

I'm not much of a C programmer - I'm just trying to get this puppy to compile. I'm not sure of the error and have run through everything on the site here but no dice. Any suggestions greatly appreciated. Its a network simulator, required libelf and the usual stuff to install but Fedora had it already installed. Many thanks to anyone who checks this out.

[chris@MtemiTux cnet-2.0.9]$ make
(cd src && make)
make[1]: Entering directory `/home/chris/cnet-2.0.9/src'
Linux 2.6.10-1.766_FC3.stk16
make[2]: Entering directory `/home/chris/cnet-2.0.9/src'
gcc -ansi -O -Wall -fPIC -Ilibelf -I/usr/X11R6/include -c parser.c
parser.c: In function `node_defn':
parser.c:423: error: conflicting types for '__CN062'
parser.c:227: error: previous declaration of '__CN062' was here
make[2]: *** [parser.o] Error 1
make[2]: Leaving directory `/home/chris/cnet-2.0.9/src'
make[1]: *** [it] Error 2
make[1]: Leaving directory `/home/chris/cnet-2.0.9/src'
make: *** [it] Error 2
[chris@MtemiTux cnet-2.0.9]$


itsme86 02-27-2005 03:49 PM

Can you copy and paste the definition of __CN062 from lines 227 and 423 of parser.c?

snecklifter 02-27-2005 03:54 PM

Love to.

Line 227: extern void init_reboot_args(NODEATTR *na, int argc, char **argv);

Line 423: extern void init_reboot_args(int n, int argc, char **argv);


itsme86 02-27-2005 04:17 PM

Well, it definitely looks like the definitions conflict. There's probably #if/#endif's surrounding one or the other definition. There should be a way to make the compiler only use 1 of them. Either through a compile option or changing a makefile or something.

sanatox 03-26-2005 11:51 AM

well, i have the same problem. Im trying to install cnet on my fedora but i got the same error. i tried to comment the second definition and it seems to work. but dont. the cnet compiler doesnt work later. any suggestion about the Makefile??


funezto 04-08-2005 03:06 PM

Well, after some checks, I have the solution.

Change in line 423 the first parameter to 'NODEATTR *na'

Old line 423: extern void init_reboot_args(int n, int argc, char **argv);
New line 423: extern void init_reboot_args(NODEATTR *na, int argc, char **argv);

So its the same as line 227.

Then, there is another problem with CNET_exit, so you should change file 'src/exit.c' in line 27:

void CNET_exit(char *filenm, char *function, int lineno)


void CNET_exit(const char *filenm, const char *function, int lineno)

then make. It worked fine for me.


snecklifter 04-08-2005 06:59 PM

Cheers felipe, much appreciated. This has sorted a long standing problem for me. Wish I knew more C. Affero left.

Just to add you also need to change the line in cnet.h to match the changes in exit.c

All times are GMT -5. The time now is 08:04 PM.