This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

Wireshark build fails when trying to compile plugin

1

Hi,

I'm trying to compile a plugin for Wireshark version 1.10.5 and am getting the following error:

c:\wireshark\epan\except.h(97) : error C2054: expected '(' to follow 'WS_MSVC_NORETURN'
c:\wireshark\epan\except.h(97) : error C2085: 'except_rethrow' : not in formal parameter list
c:\wireshark\epan\except.h(98) : error C2082: redefinition of formal parameter 'WS_MSVC_NORETURN'
c:\wireshark\epan\except.h(98) : error C2143: syntax error : missing ';' before 'type'
c:\wireshark\epan\except.h(98) : error C2085: 'except_throw' : not in formal parameter list
c:\wireshark\epan\except.h(99) : error C2082: redefinition of formal parameter 'WS_MSVC_NORETURN'
c:\wireshark\epan\except.h(99) : error C2143: syntax error : missing ';' before 'type'
c:\wireshark\epan\except.h(99) : error C2085: 'except_throwd' : not in formal parameter list
c:\wireshark\epan\except.h(100) : error C2082: redefinition of formal parameter 'WS_MSVC_NORETURN'
c:\wireshark\epan\except.h(100) : error C2143: syntax error : missing ';' before 'type'
c:\wireshark\epan\except.h(100) : error C2085: 'except_throwf' : not in formal parameter list
c:\wireshark\epan\except.h(101) : error C2085: 'except_unhandled_catcher' : not in formal parameter list
c:\wireshark\epan\except.h(102) : error C2085: 'except_code' : not in formal parameter list
c:\wireshark\epan\except.h(103) : error C2085: 'except_group' : not in formal parameter list
c:\wireshark\epan\except.h(104) : error C2085: 'except_message' : not in formal parameter list
c:\wireshark\epan\except.h(105) : error C2085: 'except_data' : not in formal parameter list
c:\wireshark\epan\except.h(106) : error C2085: 'except_take_data' : not in formal parameter list
c:\wireshark\epan\except.h(107) : error C2085: 'except_set_allocator' : not in formal parameter list
c:\wireshark\epan\except.h(108) : error C2085: 'except_alloc' : not in formal parameter list
c:\wireshark\epan\except.h(109) : error C2085: 'except_free' : not in formal parameter list
C:\wireshark\epan/tvbuff.h(59) : error C2085: 'tvbuff_type' : not in formal parameter list
C:\wireshark\epan/tvbuff.h(70) : error C2085: 'tvb_backing_t' : not in formal parameter list
C:\wireshark\epan/tvbuff.h(81) : error C2085: 'tvb_comp_t' : not in formal parameter list
C:\wireshark\epan/tvbuff.h(83) : error C2085: 'tvbuff_free_cb_t' : not in formal parameter list
C:\wireshark\epan/tvbuff.h(87) : error C2016: C requires that a struct or union has at least one member
C:\wireshark\epan/tvbuff.h(87) : error C2061: syntax error : identifier 'tvbuff_type'
C:\wireshark\epan/tvbuff.h(100) : error C2016: C requires that a struct or union has at least one member
C:\wireshark\epan/tvbuff.h(100) : error C2061: syntax error : identifier 'tvb_backing_t'
C:\wireshark\epan/tvbuff.h(101) : error C2061: syntax error : identifier 'composite'
C:\wireshark\epan/tvbuff.h(101) : error C2059: syntax error : ';'               
C:\wireshark\epan/tvbuff.h(102) : error C2059: syntax error : '}'
C:\wireshark\epan/tvbuff.h(122) : error C2061: syntax error : identifier 'free_cb'
C:\wireshark\epan/tvbuff.h(122) : error C2059: syntax error : ';'
C:\wireshark\epan/tvbuff.h(123) : error C2059: syntax error : '}'
C:\wireshark\epan/tvbuff.h(158) : error C2143: syntax error : missing '{' before '*'
C:\wireshark\epan/tvbuff.h(179) : error C2143: syntax error : missing ')' before '*'
C:\wireshark\epan/tvbuff.h(179) : error C2143: syntax error : missing '{' before '*'
C:\wireshark\epan/tvbuff.h(179) : error C2059: syntax error : ')'               
C:\wireshark\epan/tvbuff.h(179) : error C2059: syntax error : ';'
C:\wireshark\epan/tvbuff.h(182) : error C2143: syntax error : missing ')' before '*'
C:\wireshark\epan/tvbuff.h(182) : error C2143: syntax error : missing '{' before '*'
C:\wireshark\epan/tvbuff.h(182) : error C2059: syntax error : ')'
C:\wireshark\epan/tvbuff.h(182) : error C2059: syntax error : ';'
C:\wireshark\epan/tvbuff.h(185) : error C2143: syntax error : missing ')' before '*'
C:\wireshark\epan/tvbuff.h(185) : error C2143: syntax error : missing '{' before '*'
C:\wireshark\epan/tvbuff.h(185) : error C2059: syntax error : ','
C:\wireshark\epan/tvbuff.h(185) : error C2059: syntax error : ')'
C:\wireshark\epan/tvbuff.h(192) : error C2143: syntax error : missing ')' before '*'
C:\wireshark\epan/tvbuff.h(192) : error C2143: syntax error : missing '{' before '*'
C:\wireshark\epan/tvbuff.h(192) : error C2059: syntax error : ','
C:\wireshark\epan/tvbuff.h(192) : error C2059: syntax error : ')'
C:\wireshark\epan/tvbuff.h(198) : error C2143: syntax error : missing ')' before '*'
C:\wireshark\epan/tvbuff.h(198) : error C2143: syntax error : missing '{' before '*'
C:\wireshark\epan/tvbuff.h(198) : error C2059: syntax error : ','
C:\wireshark\epan/tvbuff.h(198) : error C2059: syntax error : ')'
C:\wireshark\epan/tvbuff.h(210) : error C2143: syntax error : missing ')' before '*'
C:\wireshark\epan/tvbuff.h(210) : error C2143: syntax error : missing '{' before '*'
C:\wireshark\epan/tvbuff.h(210) : error C2143: syntax error : missing ';' before '*'
C:\wireshark\epan/tvbuff.h(210) : error C2059: syntax error : ')'
C:\wireshark\epan/tvbuff.h(212) : error C2143: syntax error : missing '{' before '*'
C:\wireshark\epan/tvbuff.h(212) : error C2143: syntax error : missing ')' before '*'
C:\wireshark\epan/tvbuff.h(212) : error C2143: syntax error : missing '{' before '*'
C:\wireshark\epan/tvbuff.h(212) : error C2371: 'guint8' : redefinition; different basic types
        C:\wireshark-win32-libs-1.6\gtk2\lib\glib-2.0\include\glibconfig.h(36) : see declaration of 'guint8'
C:\wireshark\epan/tvbuff.h(212) : warning C4228: nonstandard extension used : qualifiers after comma in declarator list are ignored
C:\wireshark\epan/tvbuff.h(212) : error C2143: syntax error : missing ';' before '*'
C:\wireshark\epan/tvbuff.h(212) : warning C4142: benign redefinition of type
C:\wireshark\epan/tvbuff.h(212) : error C2370: 'guint' : redefinition; different storage class
        C:\wireshark-win32-libs-1.6\gtk2\include\glib-2.0\glib/gtypes.h(56) : see declaration of 'guint'
C:\wireshark\epan/tvbuff.h(212) : warning C4228: nonstandard extension used : qualifiers after comma in declarator list are ignored
C:\wireshark\epan/tvbuff.h(212) : error C2146: syntax error : missing ';' before identifier 'length'
C:\wireshark\epan/tvbuff.h(212) : warning C4142: benign redefinition of type
C:\wireshark\epan/tvbuff.h(213) : error C2059: syntax error : 'type'
C:\wireshark\epan/tvbuff.h(213) : error C2059: syntax error : ')'
C:\wireshark\epan/tvbuff.h(216) : error C2143: syntax error : missing ')' before '*'
C:\wireshark\epan/tvbuff.h(216) : error C2143: syntax error : missing '{' before '*'
C:\wireshark\epan/tvbuff.h(216) : error C2059: syntax error : ','
C:\wireshark\epan/tvbuff.h(217) : error C2059: syntax error : ')'
C:\wireshark\epan/tvbuff.h(220) : error C2143: syntax error : missing '{' before '*'
C:\wireshark\epan/tvbuff.h(237) : error C2143: syntax error : missing ')' before '*'
C:\wireshark\epan/tvbuff.h(237) : error C2143: syntax error : missing '{' before '*'
C:\wireshark\epan/tvbuff.h(237) : error C2143: syntax error : missing ';' before '*'
C:\wireshark\epan/tvbuff.h(238) : error C2370: 'gint' : redefinition; different storage class
        C:\wireshark-win32-libs-1.6\gtk2\include\glib-2.0\glib/gtypes.h(50) : see declaration of 'gint'
C:\wireshark\epan/tvbuff.h(238) : warning C4228: nonstandard extension used : qualifiers after comma in declarator list are ignored
C:\wireshark\epan/tvbuff.h(238) : error C2146: syntax error : missing ';' before identifier 'backing_offset'
C:\wireshark\epan/tvbuff.h(238) : error C2059: syntax error : 'type'
C:\wireshark\epan/tvbuff.h(238) : error C2059: syntax error : ')'
C:\wireshark\epan/tvbuff.h(242) : error C2143: syntax error : missing '{' before '*'
C:\wireshark\epan/tvbuff.h(242) : error C2143: syntax error : missing ')' before '*'
C:\wireshark\epan/tvbuff.h(242) : error C2143: syntax error : missing '{' before '*'
C:\wireshark\epan/tvbuff.h(243) : error C2370: 'gint' : redefinition; different storage class
        C:\wireshark-win32-libs-1.6\gtk2\include\glib-2.0\glib/gtypes.h(50) : see declaration of 'gint'
C:\wireshark\epan/tvbuff.h(243) : warning C4228: nonstandard extension used : qualifiers after comma in declarator list are ignored
C:\wireshark\epan/tvbuff.h(243) : error C2146: syntax error : missing ';' before identifier 'backing_offset'
C:\wireshark\epan/tvbuff.h(243) : error C2059: syntax error : 'type'
C:\wireshark\epan/tvbuff.h(243) : error C2059: syntax error : ')'
C:\wireshark\epan/tvbuff.h(247) : error C2143: syntax error : missing '{' before '*'
C:\wireshark\epan/tvbuff.h(247) : error C2143: syntax error : missing ')' before '*'
C:\wireshark\epan/tvbuff.h(247) : error C2143: syntax error : missing '{' before '*'
C:\wireshark\epan/tvbuff.h(248) : error C2370: 'gint' : redefinition; different storage class
        C:\wireshark-win32-libs-1.6\gtk2\include\glib-2.0\glib/gtypes.h(50) : see declaration of 'gint'
C:\wireshark\epan/tvbuff.h(248) : warning C4228: nonstandard extension used : qualifiers after comma in declarator list are ignored
C:\wireshark\epan/tvbuff.h(248) : error C2146: syntax error : missing ';' before identifier 'backing_offset'
C:\wireshark\epan/tvbuff.h(248) : error C2059: syntax error : ')'
C:\wireshark\epan/tvbuff.h(255) : error C2143: syntax error : missing ')' before '*'
C:\wireshark\epan/tvbuff.h(255) : error C2143: syntax error : missing '{' before '*'
C:\wireshark\epan/tvbuff.h(255) : error C2143: syntax error : missing ';' before '*'
C:\wireshark\epan/tvbuff.h(255) : error C2059: syntax error : ')'
C:\wireshark\epan/tvbuff.h(258) : error C2143: syntax error : missing ')' before '*'
C:\wireshark\epan/tvbuff.h(258) : error C2143: syntax error : missing '{' before '*'
C:\wireshark\epan/tvbuff.h(258) : error C2143: syntax error : missing ';' before '*'
C:\wireshark\epan/tvbuff.h(258) : error C2059: syntax error : ')'
C:\wireshark\epan/tvbuff.h(258) : fatal error C1003: error count exceeds 100; stopping compilation
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.

I know this question is similar to http://ask.wireshark.org/questions/15580/windows-build-suddenly-failed-after-svn-sync but the solution to this question didnt help me. I tried changing the include in my plugin file the way the solution to that question suggested and the build still failed. Also when i tried to build this plugin using version 1.11.3 it worked fine, however i need to use 1.10.5 so i dont know what to do.

Thanks in advance

asked 13 Jan '14, 08:07

Hockeyfreak889's gravatar image

Hockeyfreak889
16114
accept rate: 0%

edited 13 Jan '14, 08:47

grahamb's gravatar image

grahamb ♦
19.8k330206

There are API and changes to #includes between 1.10.x and 1.11.x so I'd compare with the includes of the plugins that ship with 1.10.x. If you show us the include section of your plugin we might be able to figure out what the problem is.

(14 Jan '14, 03:40) Anders ♦

the include section of the plugin consists of the following:

#include "config.h"
#include <glib.h>
#include <epan\packet.h>

Note: The Q&A markup doesn't play nicely with #includes.

(14 Jan '14, 05:56) Hockeyfreak889

I don't have a 1.10 ref handy, how is "config.h" included in the "standard" plugins?

(14 Jan '14, 09:24) Anders ♦

1.10 plugins that is.

(14 Jan '14, 09:24) Anders ♦

Looking at packet-gryphon.c as an example, it's just:

#include "config.h"
(14 Jan '14, 09:34) cmaynard ♦♦

Microsoft Visual Studio 9.0

Is that a supported build platform?

(14 Jan '14, 10:03) Kurt Knochner ♦

The Developer's Guide mentions MSVC 2010 because that's what the official releases use, but MSVC 2008 is still supported, as indicated in section 4.4.1 Toolchain Package Alternatives.

(14 Jan '14, 10:13) cmaynard ♦♦

O.K. thanks

(14 Jan '14, 10:20) Kurt Knochner ♦
showing 5 of 8 show 3 more comments

One Answer:

2

Try carefully reviewing README.plugins and comparing your plugin files to other plugins, such as gryphon.

answered 14 Jan '14, 10:02

cmaynard's gravatar image

cmaynard ♦♦
9.4k1038142
accept rate: 20%

Thanks that helped. Im not really sure what exactly i changed but when i redid all the files the way the README suggested it worked after.

(14 Jan '14, 11:03) Hockeyfreak889
1

What exactly did you change (before/after)? Might be interesting for others as well.

(14 Jan '14, 11:07) Kurt Knochner ♦

Well what happened was that I had an automated process to generate the dissector code and makefiles and what not for Wireshark version 1.4, and then when i used the same process for 1.11 it still worked so i was confused when it didnt work for 1.10. So i ended up just deleting the makefile that my automated process made and following the process in the README you posted. It was pretty straight forward and i didnt run into any problems when i did that.

(15 Jan '14, 10:35) Hockeyfreak889

Actually I've run into another problem: As this process is creating a lot of dissectors, I compiled 1 plugin and assumed it would work for the rest of them. However when i tried to apply the same process to plugins that include other C files it gives me:

LNK2019 error unresolved external symbol

I know this comes from me trying to use a function that is defined in an external source and apparently the linker isnt seeing it, but when i try to add this other file to the Makefiles (i tried to copy the process from the asn1 plugin since it appeared to have an external source as well called asn1.c) it gave me the same (or at least similar) errors to when I started.

Sorry if this is a basic question, i really dont know much about C or Makefiles, or wireshark for that matter.

(15 Jan '14, 13:17) Hockeyfreak889