Hi All, Recently I began to work with Wireshark, so I have little experience with the "plugin" environment or setup. When I attempted to install the plugin by building Wireshark, I got the following errors. Could someone tell me what I'm doing wrong and/or what I can do to fix it? Thanks! Ian
[non-relevant errors snipped for brevity]
asked 11 Jun ‘12, 10:47 Ian edited 11 Jun ‘12, 14:08 grahamb ♦ |
2 Answers:
From the first error line you seem to be missing the path to glibconfig.h that has the definition of guint32. I suspect that your build environment is't set up correctly. Have you followed all the steps in the Developers Guide for Win32 builds exactly as laid out? answered 11 Jun '12, 12:03 grahamb ♦ showing 5 of 15 show 10 more comments |
There is a syntax error in your code either before or with the include statement for
Please post 10-20 lines of your code in front of the include statement. Regards answered 11 Jun '12, 11:34 Kurt Knochner ♦ Hi Kurt, Thanks for replying so quickly, here's the lines. ifdef HAVE_CONFIG_Hinclude "config.h"endif/ Include only as needed / include <stdio.h>include <gmodule.h>include <stdlib.h>include <string.h>include <glib.h>include <epan packet.h="">include <epan prefs.h="">include <epan emem.h="">include <epan reassemble.h="">(11 Jun '12, 12:09) Ian the last include statements look pretty strange, but I guess that's just a copy-paste error with the Q&A site, right? (11 Jun '12, 12:51) Kurt Knochner ♦ Ya, it should be: include <epan.reassemble.h> with the # in front (11 Jun '12, 13:23) Ian 1 Windows does not like declarations in the middle of the code, is that what you are doing? (11 Jun '12, 13:45) Anders ♦ These are declarations at the top of the plugin I'm trying to write, and I was showing Kurt that the include statements should be correct.
(11 Jun ‘12, 13:54) Ian Loose the gmodule.h include. (12 Jun ‘12, 05:45) Jaap ♦ showing 5 of 6 show 1 more comments |
@grahamb,
Thanks for that note, corrected that and half of the errors disappeared.
Okay, however, ...
is still coming back as an improper use of the guint8 variable, why would this be? A previous use of guint8...
did indeed work, but why wouldn't the former line?
What's the exact error message for the error?
It's always best to ensure you can compile a standard copy of Wireshark before you try to add anything new. Have you managed that?
I have indeed, and everything works fine, but this is the first plugin from scratch for me.
packet-ipa.c(284) : error C2275: 'guint8' : illegal use of this type as an expression C:\wireshark-win32-libs-1.6\gtk2\lib\glib2.0\include\glibconfig.h(36) : see declaration of 'guint8' packet-ipa.c(284) : error C2146: syntax error : missing ';' before identifier 'flags' packet-ipa.c(284) : error C2065: 'flags' : undeclared identifier
Possibly missing a statement terminator on the previous line?
Can you post a bit of context for the erroring statement?
Can't see the issue :-( Is flags declared earlier in the function?
When stuck like this I just comment out bits until I find what the compiler is upset about.
Ya, I did mass chunks of commenting and it compiled for the first time :) I'll keep at it, thanks!
I think Anders nailed it. You can't declare flags there.
While this is true for .c files (I think this is part of the C standard), the usual VS error for this is:
error C2143: syntax error : missing ';' before 'type'
.Using this file:
void main(void) { int dummy = 0; dummy = 4*2; int dummy2 = dummy; }
Gives the output:
c:\users\graham\Documents>cl test.c Microsoft (R) C/C++ Optimizing Compiler Version 16.00.40219.01 for x64 Copyright (C) Microsoft Corporation. All rights reserved.
test.c test.c(5) : error C2143: syntax error : missing ';' before 'type'
The error is the same for VS2005 & VS2010
if you compile that with
gcc -pedantic
it tells the reason for the error:Seems to be the C90 standard. gcc accepts the code and does only warn with -pedantic.
And that's why we declare all vars in dissectors at the start of the function, for portability. From the Developers Guide (1.1.1 Portability):
Don't declare variables in the middle of executable code; not all C compilers support that. Variables should be declared outside a function, or at the beginning of a function or compound statement.
Still not sure why the OP is getting a different error though.
hard to say without the code. I assume your previous statement ("Possibly missing a statement terminator") nails it down, as uncommenting large parts of the code "fixes" the problem.
Got it to work, thanks guys :)
what was the problem?
What Graham said basically summed it up: VS didn't like me putting declarations within functions themselves, so I declared all vars that were giving me errors at the beginning :)