Page 1 of 1

LNK2019 and WX_DEFINE_EXPORTED_ARRAY

Posted: Mon May 25, 2009 2:27 pm
by mael15
hi everyone,

i am trying to build a wxWidgets dll and get the following error:

Code: Select all

1>bundle.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class libdf::DTube * & __thiscall libdf::ArrayOfDTube::Item(unsigned int)const " ([email protected]
as far as i understand this, wxArray->Item() cannot be found in ArrayOfDTube.

now, ArrayOfDTube is defined as

Code: Select all

WX_DEFINE_EXPORTED_ARRAY(DTube *, ArrayOfDTube);
and also DTube is declared as
class __declspec(dllexport) DTube
why this error then?
all needed files are within the same unit, so no additional libs have to be linked, right?

thanx in advance!

ps: i avoid posting the full code since the file has >1000 lines.

Re: LNK2019 and WX_DEFINE_EXPORTED_ARRAY

Posted: Mon May 25, 2009 2:53 pm
by tan
Hi,
mael15 wrote:hi everyone,

i am trying to build a wxWidgets dll and get the following error:

Code: Select all

1>bundle.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class libdf::DTube * & __thiscall libdf::ArrayOfDTube::Item(unsigned int)const " ([email protected]
as far as i understand this, wxArray->Item() cannot be found in ArrayOfDTube.

now, ArrayOfDTube is defined as

Code: Select all

WX_DEFINE_EXPORTED_ARRAY(DTube *, ArrayOfDTube);
i guess you have to use
WX_DEFINE_USER_EXPORTED_ARRAY(T, name, exportspec)
macro instead of
WX_DEFINE_EXPORTED_ARRAY(T, name)

Look here: http://docs.wxwidgets.org/stable/wx_wxa ... efinearray

Posted: Mon May 25, 2009 3:41 pm
by mael15
yeah, that sounds great!
stupid question maybe, but what do they mean with the third parameter "exportspec"? i cound not find any explanation...

Posted: Mon May 25, 2009 5:14 pm
by tan
mael15 wrote:yeah, that sounds great!
stupid question maybe, but what do they mean with the third parameter "exportspec"? i cound not find any explanation...
Well, i believe it is class __declspec(dllexport).

Posted: Tue May 26, 2009 7:49 am
by mael15
aaaaah yeah!
that helped me a great deal, thanx!
absolutely nothing to find about this on the net...