We're now a non-profit! Support open source packet analysis by making a donation.

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

From: sagar Guledagudda <[email protected]>
Date: Tue, 19 Jul 2011 10:40:24 +0530
I am compiling it for linux ( xxx.so file )
Includes files are as below

# include "config.h"
#include <stdio.h>
#include <glib.h>
#include <epan/packet.h>
//      fastfix API
#include         <fastapi.h>
#include <string.h>

CC   = g++

        mkdir -p $(PLUGIN_DIR)
        $(CC) -shared $(OBJS) $(LIBS)-o [email protected]
%.o : %.cpp
        $(CC) $(CFLAGS) $(LIBS) $< -o [email protected]

On Mon, Jul 18, 2011 at 9:34 PM, Helge Kruse <[email protected]> wrote:
Am 18.07.2011 16:45, schrieb sagar sg:

compiler i am using is  g++
parameters -   -fPIC
root/wireshark/wireshark-1.4.7/epan/tfs.h:56: error: expected constructor,
destructor, or type conversion before âconstâ
error is in the file given above .. its not showing in the dissector code.

On Mon, Jul 18, 2011 at 6:53 PM, Helge Kruse<[email protected]net>wrote:

Am 18.07.2011 11:24, schrieb sagar sg:

        My Dissector is in C++ and internally uses wireshark libraries (
epan ) , Is there any way to wrote makefile such that we can mix the gcc
g++ compilers for particular type of code to be compiled with
compiler ??

Sagar G

When you want to address C/C++ mixed code you just need to discuss how to
write the source code and how to use the compilers. Regarding your problem
to compile something that includes tfs.h you should send following:

- the name of the compiler that is actually started (gcc,g++)
- the exact list of parameters passed to the compiler
- the exact error message, (copy&paste is your friend)
- an excerpt of your source file with all lines including the line that
causes the error.

So, if you could send _all_ requested information we could help.

- You did not show the order of included header files. It looks like you scrambled something here so that WS_VAR_IMPORT is not defined properly.
- I don't believe that only -fPIC is passed to compiler, at least -c is must be given.

One additional information would be useful: do you compile for Windows (xxx.DLL) or for Linux (xxx.so)

Sent via:    Wireshark-dev mailing list <[email protected]>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
           mailto:[email protected]wireshark.org?subject=unsubscribe