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

Fatal Error U1077 return code 0x2 when compiling plugins on Windows

0

When I try to nmake my plugins on the latest x64 Windows build, I encounter this error:

    Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.
packet-ptcm.c
plugin.c
packet-ptcm.c(199) : error C2220: warning treated as error - no 'object' file generated
packet-ptcm.c(199) : warning C4047: 'function' : 'expert_field *' differs in levels of indirection from 'int'
packet-ptcm.c(199) : warning C4024: 'expert_add_info_format' : different types for formal and actual parameter 3
packet-ptcm.c(199) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int'
packet-ptcm.c(199) : warning C4024: 'expert_add_info_format' : different types for formal and actual parameter 4
packet-ptcm.c(212) : warning C4047: 'function' : 'expert_field *' differs in levels of indirection from 'int'
packet-ptcm.c(212) : warning C4024: 'expert_add_info_format' : different types for formal and actual parameter 3
packet-ptcm.c(212) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int'
packet-ptcm.c(212) : warning C4024: 'expert_add_info_format' : different types for formal and actual parameter 4
packet-ptcm.c(219) : warning C4047: 'function' : 'expert_field *' differs in levels of indirection from 'int'
packet-ptcm.c(219) : warning C4024: 'expert_add_info_format' : different types for formal and actual parameter 3
packet-ptcm.c(219) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int'
packet-ptcm.c(219) : warning C4024: 'expert_add_info_format' : different types for formal and actual parameter 4
packet-ptcm.c(230) : error C2198: 'dissector_try_heuristic' : too few arguments for call
packet-ptcm.c(381) : warning C4113: 'int (__cdecl *)(tvbuff_t *,packet_info *,proto_tree *)' differs in parameter lists from 'new_dissector_t'
packet-ptcm.c(382) : warning C4113: 'int (__cdecl *)(tvbuff_t *,packet_info *,proto_tree *)' differs in parameter lists from 'new_dissector_t'
packet-ptcm.c(395) : warning C4113: 'int (__cdecl *)(tvbuff_t *,packet_info *,proto_tree *)' differs in parameter lists from 'heur_dissector_t'
packet-ptcm.c(398) : warning C4113: 'int (__cdecl *)(tvbuff_t *,packet_info *,proto_tree *)' differs in parameter lists from 'heur_dissector_t'
packet-ptcm.c(414) : warning C4113: 'int (__cdecl *)(tvbuff_t *,packet_info *,proto_tree *)' differs in parameter lists from 'heur_dissector_t'
packet-ptcm.c(417) : warning C4113: 'int (__cdecl *)(tvbuff_t *,packet_info *,proto_tree *)' differs in parameter lists from 'heur_dissector_t'
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.

I was able to compile successfully on the latest Linux build, but I can't figure out Windows. What should I do?

asked 29 May '14, 08:02

Thomas%20G's gravatar image

Thomas G
26459
accept rate: 100%


2 Answers:

0

I was able to solve the problem. The error that was preventing the build from continuing was

packet-ptcm.c(230) : error C2198: 'dissector_try_heuristic' : too few arguments for call

and I solved it by finding the line

if (! dissector_try_heuristic(heur_dissector_list, payload, pinfo, ptcm_tree)) {

and adding a NULL parameter to dissector_try_heuristic

if (! dissector_try_heuristic(heur_dissector_list, payload, pinfo, ptcm_tree, NULL)) {

This was necessary because of an API change which added an extra parameter to that function.

answered 30 May '14, 11:55

Thomas%20G's gravatar image

Thomas G
26459
accept rate: 100%

0

Have you switched from an x86 to x64 build? If so, did you run a "clean" and check there were no old .obj and lib files lying around?

Can you build a vanilla version without your plugin?

What version are you building, is the source from git, or via a tarball\zip?

answered 29 May '14, 09:38

grahamb's gravatar image

grahamb ♦
19.8k330206
accept rate: 22%

I have only ever used an x64 build
I can build a vanilla version without my plugins
I am using version 1.10.7 from git

These plugins were made by a previous employee for version 1.9 and later patched for 1.10 compatibility, and they have no problems running on linux.

(29 May '14, 09:43) Thomas G

It's going to be difficult to comment further without actually seeing the code. Can you post it in a public space anywhere?, or at least an excerpt from around line 199 including context before and after. It looks like a variable type declaration is incorrect somewhere, maybe an include issue.

(29 May '14, 10:12) grahamb ♦