LNK2019 and WX_DEFINE_EXPORTED_ARRAY Topic is solved

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
mael15
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 539
Joined: Fri May 22, 2009 8:52 am
Location: Bremen, Germany

LNK2019 and WX_DEFINE_EXPORTED_ARRAY

Post 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 " (__imp_?Item@ArrayOfDTube
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.
tan
wxWorld Domination!
wxWorld Domination!
Posts: 1471
Joined: Tue Nov 14, 2006 7:58 am
Location: Saint-Petersburg, Russia

Re: LNK2019 and WX_DEFINE_EXPORTED_ARRAY

Post 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 " (__imp_?Item@ArrayOfDTube
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
OS: Windows XP Pro
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10
mael15
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 539
Joined: Fri May 22, 2009 8:52 am
Location: Bremen, Germany

Post 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...
tan
wxWorld Domination!
wxWorld Domination!
Posts: 1471
Joined: Tue Nov 14, 2006 7:58 am
Location: Saint-Petersburg, Russia

Post 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).
OS: Windows XP Pro
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10
mael15
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 539
Joined: Fri May 22, 2009 8:52 am
Location: Bremen, Germany

Post by mael15 »

aaaaah yeah!
that helped me a great deal, thanx!
absolutely nothing to find about this on the net...
Post Reply