compilation error

asked 2020-04-27 16:03:10 +0000

yaroni gravatar image

updated 2020-04-28 05:24:31 +0000

I tried to add a field in the cfile.h in _capture_file.

typedef struct _capture_file {
     gboolean                    option_enabled;
     ...

In packet-gsm_sms.c i've added

#include "globals.h"
extern capture_file cfile;

And in one of the function code

if(cfile.option_enabled)
....

And use the new field option_enabled in ../epan/dissectors/packet-gsm_sms.c as it is used in tshark.c .
I got the following error

/bin/ld: run/tshark: hidden symbol `cfile' in CMakeFiles/tshark.dir/tshark.c.o is referenced by DSO

I compile the following way
git clone
mkdir build
cd build
cmake3 -G'Unix Makefiles' -DCMAKE_INSTALL_PREFIX=. ..
make -j8 tshark

edit retag flag offensive close merge delete

Comments

Did it compile before you changed cfile.h?

Guy Harris gravatar imageGuy Harris ( 2020-04-27 19:10:17 +0000 )edit

yes, it compiled before,
i just saw that the problem is not cause by tshark.c file but by the use of cfile in ../epan/dissectors/packet-gsm_sms.c
It still doesn't compile

yaroni gravatar imageyaroni ( 2020-04-27 20:59:39 +0000 )edit

So where is cfile used in epan/dissectors/packet-gsm_sms.c?

Guy Harris gravatar imageGuy Harris ( 2020-04-27 23:42:18 +0000 )edit

I added cfile use in packet-gsm_sms.c but it doesn't compile. It wasn't before my change, i do it to pass information from tshark.c to packet-gsm_sms.c file.

yaroni gravatar imageyaroni ( 2020-04-28 05:17:45 +0000 )edit

It doesn't compile because you changed it to refer to cfile.

Don't do that; the way Wireshark and TShark are constructed, it's not supported, and we don't even guarantee that there will always be a cfile in future releases.

What sort of information are you trying to pass from tshark.c?

Guy Harris gravatar imageGuy Harris ( 2020-04-28 07:38:11 +0000 )edit