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

I'm trying to test a dissector plug in for wireshark in Linux by following these steps. When I use sudo make -C plugins, I get several similar compilation errors say that MySourceFileDissectorName.c: In function 'X': MySourceFileDissectorName.c:990:11: error: request for implicit conversion from 'gpointer' to 'some struct data type *' not permitted in C++ [-Werror=c++-compat] .... etc.

I've no idea what the cause of the error or how can I resolve it. Any ideas or hints!

Thanks in advance!

asked 15 Jun '14, 14:18

flora's gravatar image

flora
156313338
accept rate: 100%

sudo make -C plugins

You should not run your compiler as root. Neither should you run Wireshark as root.

(16 Jun '14, 02:28) Jaap ♦

Thanks for your comment but Why not?!

(16 Jun '14, 10:45) flora
1

Because any program running as root has the ability to do many more harmful things to your system than a program running under your own user ID, so a bug (or misfeature!) in the compiler, or linker, or "make", or Wireshark, or... can cause more problems if you run the program as root than if you run it as yourself.

(16 Jun '14, 10:52) Guy Harris ♦♦

Thank you so much Guy! I've come across Jaap's comment several times in different contexts and just now I knew the reason behind that.

(16 Jun '14, 11:22) flora

The cause of the error is that

  • C++, unlike C, does not allow void * (gpointer is a GLib alias for void *) to be cast to another type value without a case;
  • we want to make sure our C code can be compiled by C++ compilers;

so we build the code with "-Werror=c++-compat".

You resolve it by doing

void *foo;
struct hello *bar;

    ...

bar = (struct hello *)foo;

rather than

void *foo;
struct hello *bar;

    ...

bar = foo;
permanent link

answered 15 Jun '14, 15:49

Guy%20Harris's gravatar image

Guy Harris ♦♦
17.4k335196
accept rate: 19%

Thank you. This solves the problem.

(16 Jun '14, 09:24) flora
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×1,620
×193
×173
×18

question asked: 15 Jun '14, 14:18

question was seen: 1,699 times

last updated: 16 Jun '14, 11:22

p​o​w​e​r​e​d by O​S​Q​A