PDA

View Full Version : Make Error : packet.cpp:2824: duplicate case value



ultra2
05-26-2003, 03:54 PM
Hello,

Compiling last version on a MANDRAKE 9.1 with what i think are all the required versions of the libs i get the following error:
g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/lib/qt3/include -I/usr/X11R6/include -DMAPDIR=\"/usr/local/share/showeq\" -DLOGDIR=\"/usr/local/share/showeq\" -I/usr/include/pcap -D_REENTRANT -O2 -Wall -g -ggdb -DDEBUG -finline-functions -DQT_THREAD_SUPPORT=1 -DDISPLAY_ICONS=false -DICON_DIR=\"/eq-icons/\" -c packet.cpp
packet.cpp: In member function `void EQPacket::dispatchZoneData(unsigned int, uint8_t*, unsigned char)':
packet.cpp:2824: duplicate case value
packet.cpp:2304: previously used here
make[2]: *** [packet.o] Erreur 1
make[2]: Leaving directory `/seq/showeq/src'
make[1]: *** [all-recursive] Erreur 1
make[1]: Leaving directory `/seq/showeq'
make: *** [all-recursive-am] Erreur 2



I add the ./configure infos in case it can help sorting this out:

creating cache ./config.cache
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking build system type... i686-pc-linux-gnu
checking for a BSD compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking whether make sets ${MAKE}... yes
checking for working aclocal-1.4... found
checking for working autoconf... found
checking for working automake-1.4... found
checking for working autoheader... found
checking for working makeinfo... missing
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... gcc
checking for g++... g++
checking for supported compiler version... yes
checking for gcc... gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking for c++... g++
checking whether the C++ compiler (g++ ) works... yes
checking whether the C++ compiler (g++ ) is a cross-compiler... no
checking whether we are using GNU C++... yes
checking whether g++ accepts -g... yes
checking how to run the C preprocessor... gcc -E
checking for working const... yes
checking for a BSD compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking whether make sets ${MAKE}... (cached) yes
checking for Cygwin environment... no
checking for mingw32 environment... no
checking for ld used by GCC... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking for a sed that does not truncate output... /bin/sed
checking how to recognise dependent libraries... pass_all
checking for object suffix... o
checking for executable suffix... no
checking command to parse /usr/bin/nm -B output... ok
checking for dlfcn.h... yes
checking for ranlib... ranlib
checking for strip... strip
checking for objdir... .libs
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.lo... yes
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking whether the linker (/usr/bin/ld) supports shared libraries... yes
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether -lc should be explicitly linked in... no
creating libtool
checking for supported libc version... yes
checking for extra includes... no
checking for extra libs... no
checking for libz... -lz
checking for X... libraries /usr/X11R6/lib, headers /usr/X11R6/include
checking for IceConnectionNumber in -lICE... yes
checking for libXext... yes
checking for libpng... -lpng -lz -lm
checking for Qt... yes
>> Found version.: 3.1.1
>>> Headers......: /usr/lib/qt3/include/
>>>> Libraries...: /usr/lib/qt3/lib/
>>>>> Workable...: -*{ YES }*-
checking for Qt MOC... yes
checking if Qt compiles without flags... no
checking for pthread_create in -lpthread... yes
setting Linux pthread compilation options
checking for pcap_open_live in -lpcap... yes
checking for gdImageCreate in -lgd... no
checking for gdImagePng in -lgd... no
checking for inflate in -lz... yes
checking for gdbm_open in -lgdbm... yes
checking how to run the C++ preprocessor... g++ -E
checking for ANSI C header files... yes
checking for deque... yes
checking for size_t... yes
checking whether to enable debugging code and flags... yes
checking whether to build with optimization enabled... yes
checking whether to build with code inlined... yes
checking whether to build with profiling... no
checking whether to build with Berkeley DB3... no
checking whether to build for use with the test server... no
checking for rpath... yes
updating cache ./config.cache
creating ./config.status
creating Makefile
creating src/Makefile
creating maps/Makefile
creating conf/Makefile
creating conf.h
Success!
Please run:
make



Can anybody help? :)

Thanks a lot

Ultraman

Mr. Suspicious
05-26-2003, 04:00 PM
Compiling last version on a MANDRAKE 9.1 with what i think are all the required versions of the libs i get the following error:

First step would be to make sure you have all required packages installed. See the INSTALL.newbies file in your showEQ directory for the list.

AMonk
05-26-2003, 04:01 PM
I am having the same problem as Ultraman sees here. I was actually using the search feature as he posted and I failed to come up with any information on this issue. (At least none that seemed relevant to a non-coder type like myself.)

Here is a snipet of my make:

=====LOG=====
g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/qt-3.0.6/include -I/usr/X11R6/include -DMAPDIR=\"/usr/local/share/showeq\" -DLOGDIR=\"/usr/local/share/showeq\" -I/usr/include/pcap -D_REENTRANT -O2 -Wall -g -ggdb -DDEBUG -finline-functions -DQT_THREAD_SUPPORT=1 -DDISPLAY_ICONS=false -DICON_DIR=\"/eq-icons/\" -c -o packet.o `test -f 'packet.cpp' || echo './'`packet.cpp
packet.cpp: In member function `void EQPacket::dispatchZoneData(unsigned int,
uint8_t*, unsigned char)':
packet.cpp:2824: duplicate case value
packet.cpp:2304: previously used here
make[3]: *** [packet.o] Error 1
make[3]: Leaving directory `/root/showeq/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/root/showeq/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/showeq'
make: *** [all] Error 2
=====LOG====

I was poking around in packet.cpp and found this entry referenced by the error:


=====CODE=====
sprintf(timeMessage,"EQTime [%02d:%02d %s]",
(eqTime.hour % 12) == 0 ? 12 : (eqTime.hour % 12),
(eqTime.minute),
((eqTime.hour >= 12 && eqTime.hour << 24) ||
(eqTime.hour == 24 && eqTime.minute == 0)) ? "pm" : "am");
...skipping...
void EQPacket::dispatchDecodedZoneSpawns(const uint8_t* decodedData,
uint32_t decodedDataLen)
{
====CODE=====

My best guess is that there is a syntax error here. /shrug. Again, I am a non-coder so, any help would be appreciated.

Edit:

I am running RedHat 8.0, it has just been patched using up2date.
I have used the last working version of SEQ with no problems.
I have checked my system for all applicable files and libraries and to the best of my knowledge, they are all correct.
In the troubleshooting process, prior to posting, I removed my /root/showeq directory and did a fresh cvs with no improvement.
If there is any further information that would help diagnose this problem, please post the question.

Thanks,

AMonk

TrainSpotter
05-26-2003, 05:16 PM
I am getting the same error.

I also had a working SEQ before, I have all the libraries/files needed.

I did cvs update (from main cvs server, didnt actually DL the tarfile that codepig uploaded... wondering if thats the problem somehow...)

pagan
05-26-2003, 07:02 PM
Welp after fixing the libEQ.h issue I did a 'make clean' and then tryed to 'make' again only to hit this error. Used the holy Search button which has always saved me in the past only to find this unresolved thread. Read all the INSTALL and README files again just to make sure they were not changed and with held the solution.

Anyone found a fix or work around ? I define Linux n00b so I cant really help myself much other then searching for the answer others have found and executing :)

Glad to see its fixed tho! This is *THE* best EQ utility out there. Your hard work really does us all a great service

/kneel

fester
05-26-2003, 07:19 PM
You obviously have two opcodes in opcode.h with the same value.
Fix opcodes.h and you will fix your compile.

AMonk
05-26-2003, 07:34 PM
Is there an easy way to search a file such as opcodes.h for duplicate entries? Sorting through a file like that is very painful.

arioch
05-26-2003, 07:42 PM
in optcode.h you will find this:

#define GroupInfoCode 0x0263
#define NpcHpUpdateCode 0x0263


Now obviously one of these is wrong, which one is the question?

pagan
05-26-2003, 07:46 PM
Unfortunatly nothing about this problem is very obviouse to me... care to expand upon these ideas?

Thank you

arioch
05-26-2003, 07:48 PM
Yes I do, these two items are used within a switch statement block and since you cannot switch on the same value twice there is an error.

This is essentially what the compiler is complaining about.

Elyon
05-26-2003, 07:58 PM
The GroupInfocode was just changed, the the other is wrong..

This thread will shed some light on it..

http://seq.sourceforge.net/forums/showthread.php?s=&threadid=3485

AMonk
05-26-2003, 08:09 PM
Ok, I just remarked both of the instances of that opcode, ran make distclean, make -f Makefile.dist, ./configure and make. This is the error:

g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/qt-3.0.6/include -I/usr/X11R6/include -DMAPDIR=\"/usr/local/share/showeq\" -DLOGDIR=\"/usr/local/share/showeq\" -I/usr/include/pcap -D_REENTRANT -O2 -Wall -g -ggdb -DDEBUG -finline-functions -DQT_THREAD_SUPPORT=1 -DDISPLAY_ICONS=false -DICON_DIR=\"/eq-icons/\" -c -o packet.o `test -f 'packet.cpp' || echo './'`packet.cpp
packet.cpp: In member function `void EQPacket::dispatchZoneData(unsigned int,
uint8_t*, unsigned char)':
packet.cpp:2304: `NpcHpUpdateCode' undeclared (first use this function)
packet.cpp:2304: (Each undeclared identifier is reported only once for each
function it appears in.)
packet.cpp:2824: `GroupInfoCode' undeclared (first use this function)
make[3]: *** [packet.o] Error 1
make[3]: Leaving directory `/root/showeq/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/root/showeq/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/showeq'
make: *** [all] Error 2


This appears to be the same issue. Is this because I remarked both entries or is it because of another dupilicate opcode? Either way, I again ask, is there any simple method by which we may search a file for duplicate entries?

arioch
05-26-2003, 08:14 PM
Ok you cannot comment out code that makes a decission and expect it to work... What do you think would happen if I commented out a couple of defined values?



#define ONE 1
#define TWO 2

int main()
{
int a = 2;

switch(a)
{
case ONE:
printf("ONE!\r\n");
break;
case TWO:
printf("TWO!\r\n");
break;
}

exit(0);
}


It would no longer know what ONE and TWO are and not know how to handle the decission.

SeqWiz
05-26-2003, 08:15 PM
AMonk...

I'm a prototypical newb but my guess is, based on the errors you received after remarking those #define lines, that these must be defined. We just need to see if anyone knows which is wrong and what they should be.

pagan
05-26-2003, 09:14 PM
Elyon: Ok read over that post and at the bottom user387 notes that the GroupInfocode is the errnouse one... so do I just change it to some number that is not already used?


Thank you.

TrainSpotter
05-26-2003, 10:34 PM
No, someone who has a working copy or knows the packet structure needs to go through it and figure out the opcode for the two in question.

If i knew how to read the packets id do it, but im learning as I go. Maybe in a week or two ill be learned enough to do some of this on my own.

fester
05-26-2003, 10:36 PM
Originally posted by AMonk
Is there an easy way to search a file such as opcodes.h for duplicate entries? Sorting through a file like that is very painful.

Oh I don't know, something like awk '{print $3}' opcodes.h | sort | uniq -c | sort -n | awk '$1 > 1 {print}' comes to mind.

fester
05-26-2003, 10:42 PM
Originally posted by AMonk
packet.cpp:2304: `NpcHpUpdateCode' undeclared (first use this function)
packet.cpp:2304: (Each undeclared identifier is reported only once for each
function it appears in.)
packet.cpp:2824: `GroupInfoCode' undeclared (first use this function)


Undeclared means "I am trying to use this, but it is not defined."

You commented out NpcHpUpdateCode and GroupInfoCode. Just because you didn't know what it is, doesn't mean the proper thing to do is comment it out. Make it 0x111 or something unused until you know what it is.

Magao
05-27-2003, 12:26 AM
Well it seems like the CVS has been fixed for opcodes.h ...but i was getting some other compile errors....mainly something about manadecrement and not having a corresponding SpellID struct....i just took that part out and it compiled fine.

thought i would post that if anyone has that problem sorry i don't have more detailed error message since i was able to make it work.

outputf("R %u %04d %d %.2X%.2X %d %d\n", timestamp, len, dir,
mana->opCode, mana->version, mana->newMana, mana->spellId);

is original line in logger.cpp and the mana->spellID portion caused an error in my make...i removed it and it compiled and made fine.

Thanks to all the devs it's nice to see a working version of SEQ again, I have been using myseq but it simply can't compare to this program.

ultra2
05-27-2003, 01:23 AM
I did a complete install of the Mandrake 9.1 (all packages) and they list the folowing version in their RPM list:

Qt 3.1.1
Qt-devel 3.1.1
Libpcap 0.7.2
Gdbm2 1.8.0
Gdbm2-devel 1.8.0
Db3 3.3.11
Db3-devel 3.3.11
Glibc 2.3.1
Libstdc++5 3.2.2
Gcc 3.2.2
Libtool 1.4.3
Autoconf2 2.57
Automake 1.7.2

I remember doing a package check withe the graphical tool supplied (a pain omg!) since i could not remember how to list the packages on shell command and they all met the INSTALL requirements.

The only thing i can't be sure is how the QT3.1.1 was compiled in the RPM (with -thread option or not).

I have tried to reinstall moste of thes packages (in case) and to totally wipe the seq dir but i still face the same problem :(

Thanks for the help :/

Ultraman

user387
05-27-2003, 02:03 AM
Originally posted by pagan
Elyon: Ok read over that post and at the bottom user387 notes that the GroupInfocode is the errnouse one... so do I just change it to some number that is not already used?


Thank you.

Pagan, READ!

this is NOT what I said.

In fact, this is plain wrong!

Elyon
05-27-2003, 10:53 AM
NO, The GroupInfoCode is the correct one. I just changed the NpcHpUpdateCode to 0x0264, because it was not correct anyway, I made it a non used number so it would compile, until the correct number is located.

AMonk
05-27-2003, 02:52 PM
I just wiped my cvs and downloaded the most recent copy. I can confirm that user387's patch fixed the compile. Excellent work!

Fester, thanks for your help with the troubleshooting information. I am going to look into awk scripting.

As a note, when I ran the command on the new copy of opcodes, this is the result:

[root@compuster src]# awk '{print $3}' opcodes.h | sort | uniq -c | sort -n | awk '$1 > 1 {print}'
2 0x014a
2 Server
122

It doesn't seem to be causing a problem. /shrug

AMonk

fester
05-27-2003, 06:06 PM
Originally posted by AMonk
2 0x014a
It doesn't seem to be causing a problem. /shrug


It shouldn't cause problems. It is meant to locate dupes. E.g.
//#define SpawnUpdateCode 0x014a
#define cCursorItemCode 0x014a

One is commented, so it isn't a real dupe.