ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] mix of c and C++

From: Helge Kruse <Helge.Kruse-nospam@xxxxxxx>
Date: Tue, 19 Jul 2011 13:08:35 +0200
Am 19.07.2011 12:02, schrieb sagar Guledagudda:
now i am getting linker error like

: undefined reference to `proto_register_protocol'
: undefined reference to `proto_register_field_array'
: undefined reference to `proto_register_subtree_array'
: undefined reference to `register_dissector'
: undefined reference to `prefs_register_protocol'
: undefined reference to `prefs_register_uint_preference'
: undefined reference to `prefs_register_string_preference'
: undefined reference to `register_init_routine'
: undefined reference to `register_postseq_cleanup_routine'

i have added library path to wireshark/epan where the proto.h is there which
contains the above functions. do u have idea abt wat els s required to be
done to get through this ?

Adding a path is not sufficient. You need to add the library file that defines the symbols. In a Windows build you add the library files _after_ the object files to the linker command line. That looks similar like this (on one line):

link -dll /out:mymodule.dll myobject1.obj myobject2.obj
..\..\epan\libwireshark.lib ..\..\wsutil\wsutil.lib ....

In a Unix-build you will replace the .lib files with .so or .sa files. I assume the .sa is deprecated.

You can compare your makefile with one of the makefiles in the plugins tree to get the idea.