Wireshark-dev: Re: [Wireshark-dev] Keep getting "unresolved external symbol" error when trying
From: Alexis La Goutte <[email protected]>
Date: Wed, 22 May 2013 10:16:31 +0200

it is problem of linking a C Library with C++
You need to use this fix :

+/* linking C functions */
+extern "C"
+#include "../summary.h"

On Wed, May 22, 2013 at 10:05 AM, Richard Turner <[email protected]> wrote:
On 2013/5/22 13:38, Pascal Quantin wrote:
Le 22/05/2013 07:30, Anders Broman a écrit :
Richard Turner skrev 2013-05-22 07:19:

I'm trying to implement the statistics summary window in QtShark, but
when I use these two functions I keep getting LNK2019 "unresolved
external symbol" error from my VS2010 compiler:

summary_fill_in(&cfile, &summary);
summary_fill_in_capture(&cfile, &global_capture_opts, &summary);

both are located in summary.c

I've tested using the two functions in main.cpp(which properly
included the headers needed), and I got the same link error.

The headers I've included are as follows:
#include <string.h>
#include <time.h>
#include "config.h"
#include <glib.h>
#include "qt_ui_utils.h"
#include <epan/strutil.h>
#include <wiretap/wtap.h>
#include "globals.h"
#include "file.h"
#include "summary.h"
#include "version_info.h"

#include "../capture.h"
#include "ui/capture_globals.h"
#include "../capture-pcap-util.h"

Try changing summary.h as follows
WS_DLL_PUBLIC extern void
summary_fill_in(capture_file *cf, summary_tally *st);

WS_DLL_PUBLIC extern void
summary_fill_in_capture(capture_file *cf, capture_options
*capture_opts, summary_tally *st);

The line
#include "ws_symbol_export.h"
should be added at the beginning of summary.h also


I'm sorry, but this won't work on my environment.

I still get the same error :

C:\Turner\Workspace\Wireshark\ui\build-QtShark-Qt4_8_4-Release\main.obj:-1: error: LNK2019: Unresolved external symbol "__declspec(dllimport) void __cdecl summary_fill_in_capture(struct _capture_file *,struct capture_options_tag *,struct _summary_tally *)" (__imp_?summary_fill_in_[email protected]@[email protected]@[email protected]@PAU_[email protected]@@Z),referenced in function _main

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