Wireshark-dev: Re: [Wireshark-dev] I want to use g_thread_init in dissector source file, but ge

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Wed, 24 Aug 2011 00:54:10 -0700
On Aug 24, 2011, at 12:11 AM, lookfar wrote:

>    正在创建库 libwireshark.lib 和对象 libwireshark.exp
> dissectors.lib(packet-ppp.obj) : error LNK2019: 无法解析的外部符号 _g_thread_ini
> t,该符号在函数 _proto_register_ppp 中被引用
> libwireshark.dll : fatal error LNK1120: 1 个无法解析的外部命令
> NMAKE : fatal error U1077: “"D:\Program Files\Microsoft Visual Studio 9.0\VC\BI
> N\link.EXE"”: 返回代码“0x460”
> Stop.
> NMAKE : fatal error U1077: “"D:\Program Files\Microsoft Visual Studio 9.0\VC\BI
> N\nmake.exe"”: 返回代码“0x2”

For those of us who don't read Chinese, Google Translate says that's

	Creating library libwireshark.lib and objects libwireshark.exp
	dissectors.lib (packet-ppp.obj): error LNK2019: unresolved external symbol _g_thread_init, the symbol is referenced in function _proto_register_ppp
	libwireshark.dll: fatal error LNK1120: 1 unresolved externals
	NMAKE: fatal error U1077: “"D:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.EXE"”: return code "0x460"
	Stop.
	NMAKE: fatal error U1077: “"D:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\nmake.exe"”: return code "0x2"
	Stop.

(why "fatal error" is in English and "return code" isn't, well...).

> My version is wireshark-1.7.0-SVN-38520,I have changed the dissector nmake file to add line like:
> 
> CFLAGS= $(WARNINGS_ARE_ERRORS) $(STANDARD_CFLAGS) \
> 	/I. /I.. /I../.. $(GLIB_CFLAGS) \
> 	$(GTHREAD_LIBS) \
> #	`pkg-config --cflags --libs glib-2.0 gthread-2.0` \
> 	$(ZLIB_CFLAGS) \
> 	$(PCRE_CFLAGS) $(GNUTLS_CFLAGS) $(NETTLE_CFLAGS) \
> 	$(KFW_CFLAGS) $(AIRPCAP_CFLAGS) $(GEOIP_CFLAGS) \
> 	/I$(PCAP_DIR)\include

What happens if you *don't* make that change, but, instead, change epan\Makefile.nmake to do something such as

libwireshark_LIBS = \
	$(GTHREAD_LIBS)	\
	$(GLIB_LIBS)	\
	$(C_ARES_LIBS) \
	$(ADNS_LIBS) \
	$(KFW_LIBS) \
	$(NETTLE_LIBS) \
	$(ZLIB_LIBS) \
	$(GNUTLS_LIBS) \
	$(LUA_LIBS) \
	$(PYTHON_LIBS) \
	$(SMI_LIBS) \
	$(GEOIP_LIBS) \
	..\wsutil\libwsutil.lib \
	..\wiretap\wiretap-$(WTAP_VERSION).lib \
	crc\crc.lib \
	crypt\airpdcap.lib \
	ftypes\ftypes.lib \
	dfilter\dfilter.lib \
	$(WSLUA_LIB) \
	$(WSPYTHON_LIB) \
	dissectors\dissectors.lib

so that libwireshark is linked with $(GTHREAD_LIBS)?