Thread and Array linking problems 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
rodrigod
I live to help wx-kind
I live to help wx-kind
Posts: 172
Joined: Thu Jun 26, 2008 8:50 pm

Thread and Array linking problems

Post by rodrigod »

Hello,

i am building a DLL, that uses arrays and threads besides other wxwidgets function. i am using VC++ 6.0 and when I build it i get linker error lnk2001 for many array and thread functions. I am almost sure that the problem is that i am not linking the right libraries. I want to know, which are the wxwidgets libraries that define arrays and threads, and which windows libraries it depends on. I didnt know what information you need to help me, so please tell me what do you need me to post here.

Thanks
FlyingIsFun1217
Super wx Problem Solver
Super wx Problem Solver
Posts: 497
Joined: Mon Nov 06, 2006 9:58 pm

Re: Thread and Array linking problems

Post by FlyingIsFun1217 »

rodrigod wrote:I want to know, which are the wxwidgets libraries that define arrays and threads, and which windows libraries it depends on.
It doesn't say in the docs?

FlyingIsFun1217
rodrigod
I live to help wx-kind
I live to help wx-kind
Posts: 172
Joined: Thu Jun 26, 2008 8:50 pm

Post by rodrigod »

I didnt find anything, but it would be great if anyone could tell me where to find it. Because i already searched it and got nothing. It is really common for me to run into this kind of trouble, if anyone got any clues i'd apreciate.

thanks
FlyingIsFun1217
Super wx Problem Solver
Super wx Problem Solver
Posts: 497
Joined: Mon Nov 06, 2006 9:58 pm

Post by FlyingIsFun1217 »

Just go to the page for the class you want to check out, and look at the info at the top. Should show you that information; You can also check out the libraries list for those sort of things.

FlyingIsFun1217 :)
rodrigod
I live to help wx-kind
I live to help wx-kind
Posts: 172
Joined: Thu Jun 26, 2008 8:50 pm

Post by rodrigod »

Thanks,

Now the problem is a little different, it is still a linker error. Now I get a LNK2005 for my wxobjarray class. Here are my errors

Code: Select all

AVMODEM.obj : error LNK2005: "public: __thiscall ArraycAVMCOM::~ArraycAVMCOM(void)" (??1ArraycAVMCOM@@QAE@XZ) already defined in AVMCOMM.obj
AVMODEM.obj : error LNK2005: "private: void __thiscall ArraycAVMCOM::DoCopy(class ArraycAVMCOM const &)" (?DoCopy@ArraycAVMCOM@@AAEXABV1@@Z) already defined in AVMCOMM.obj
AVMODEM.obj : error LNK2005: "public: class ArraycAVMCOM & __thiscall ArraycAVMCOM::operator=(class ArraycAVMCOM const &)" (??4ArraycAVMCOM@@QAEAAV0@ABV0@@Z) already defined in AVMCOMM.obj
AVMODEM.obj : error LNK2005: "public: __thiscall ArraycAVMCOM::ArraycAVMCOM(class ArraycAVMCOM const &)" (??0ArraycAVMCOM@@QAE@ABV0@@Z) already defined in AVMCOMM.obj
AVMODEM.obj : error LNK2005: "private: void __thiscall ArraycAVMCOM::DoEmpty(void)" (?DoEmpty@ArraycAVMCOM@@AAEXXZ) already defined in AVMCOMM.obj
AVMODEM.obj : error LNK2005: "public: void __thiscall ArraycAVMCOM::RemoveAt(unsigned int,unsigned int)" (?RemoveAt@ArraycAVMCOM@@QAEXII@Z) already defined in AVMCOMM.obj
AVMODEM.obj : error LNK2005: "public: void __thiscall ArraycAVMCOM::Add(class cAVMCOM * const &,unsigned int)" (?Add@ArraycAVMCOM@@QAEXABQAVcAVMCOM@@I@Z) already defined in AVMCOMM.obj
AVMODEM.obj : error LNK2005: "public: void __thiscall ArraycAVMCOM::Insert(class cAVMCOM * const &,unsigned int,unsigned int)" (?Insert@ArraycAVMCOM@@QAEXABQAVcAVMCOM@@II@Z) already defined in AVMCOMM.obj
AVMODEM.obj : error LNK2005: "public: int __thiscall ArraycAVMCOM::Index(class cAVMCOM * const &,bool)const " (?Index@ArraycAVMCOM@@QBEHABQAVcAVMCOM@@_N@Z) already defined in AVMCOMM.obj
AVMTTY.OBJ : error LNK2005: "public: __thiscall ArraycAVMCOM::~ArraycAVMCOM(void)" (??1ArraycAVMCOM@@QAE@XZ) already defined in AVMCOMM.obj
AVMTTY.OBJ : error LNK2005: "private: void __thiscall ArraycAVMCOM::DoCopy(class ArraycAVMCOM const &)" (?DoCopy@ArraycAVMCOM@@AAEXABV1@@Z) already defined in AVMCOMM.obj
AVMTTY.OBJ : error LNK2005: "public: class ArraycAVMCOM & __thiscall ArraycAVMCOM::operator=(class ArraycAVMCOM const &)" (??4ArraycAVMCOM@@QAEAAV0@ABV0@@Z) already defined in AVMCOMM.obj
AVMTTY.OBJ : error LNK2005: "public: __thiscall ArraycAVMCOM::ArraycAVMCOM(class ArraycAVMCOM const &)" (??0ArraycAVMCOM@@QAE@ABV0@@Z) already defined in AVMCOMM.obj
AVMTTY.OBJ : error LNK2005: "private: void __thiscall ArraycAVMCOM::DoEmpty(void)" (?DoEmpty@ArraycAVMCOM@@AAEXXZ) already defined in AVMCOMM.obj
AVMTTY.OBJ : error LNK2005: "public: void __thiscall ArraycAVMCOM::RemoveAt(unsigned int,unsigned int)" (?RemoveAt@ArraycAVMCOM@@QAEXII@Z) already defined in AVMCOMM.obj
AVMTTY.OBJ : error LNK2005: "public: void __thiscall ArraycAVMCOM::Add(class cAVMCOM * const &,unsigned int)" (?Add@ArraycAVMCOM@@QAEXABQAVcAVMCOM@@I@Z) already defined in AVMCOMM.obj
AVMTTY.OBJ : error LNK2005: "public: void __thiscall ArraycAVMCOM::Insert(class cAVMCOM * const &,unsigned int,unsigned int)" (?Insert@ArraycAVMCOM@@QAEXABQAVcAVMCOM@@II@Z) already defined in AVMCOMM.obj
AVMTTY.OBJ : error LNK2005: "public: int __thiscall ArraycAVMCOM::Index(class cAVMCOM * const &,bool)const " (?Index@ArraycAVMCOM@@QBEHABQAVcAVMCOM@@_N@Z) already defined in AVMCOMM.obj
AVTCPIP.OBJ : error LNK2005: "public: __thiscall ArraycAVMCOM::~ArraycAVMCOM(void)" (??1ArraycAVMCOM@@QAE@XZ) already defined in AVMCOMM.obj
AVTCPIP.OBJ : error LNK2005: "private: void __thiscall ArraycAVMCOM::DoCopy(class ArraycAVMCOM const &)" (?DoCopy@ArraycAVMCOM@@AAEXABV1@@Z) already defined in AVMCOMM.obj
AVTCPIP.OBJ : error LNK2005: "public: class ArraycAVMCOM & __thiscall ArraycAVMCOM::operator=(class ArraycAVMCOM const &)" (??4ArraycAVMCOM@@QAEAAV0@ABV0@@Z) already defined in AVMCOMM.obj
AVTCPIP.OBJ : error LNK2005: "public: __thiscall ArraycAVMCOM::ArraycAVMCOM(class ArraycAVMCOM const &)" (??0ArraycAVMCOM@@QAE@ABV0@@Z) already defined in AVMCOMM.obj
AVTCPIP.OBJ : error LNK2005: "private: void __thiscall ArraycAVMCOM::DoEmpty(void)" (?DoEmpty@ArraycAVMCOM@@AAEXXZ) already defined in AVMCOMM.obj
AVTCPIP.OBJ : error LNK2005: "public: void __thiscall ArraycAVMCOM::RemoveAt(unsigned int,unsigned int)" (?RemoveAt@ArraycAVMCOM@@QAEXII@Z) already defined in AVMCOMM.obj
AVTCPIP.OBJ : error LNK2005: "public: void __thiscall ArraycAVMCOM::Add(class cAVMCOM * const &,unsigned int)" (?Add@ArraycAVMCOM@@QAEXABQAVcAVMCOM@@I@Z) already defined in AVMCOMM.obj
AVTCPIP.OBJ : error LNK2005: "public: void __thiscall ArraycAVMCOM::Insert(class cAVMCOM * const &,unsigned int,unsigned int)" (?Insert@ArraycAVMCOM@@QAEXABQAVcAVMCOM@@II@Z) already defined in AVMCOMM.obj
AVTCPIP.OBJ : error LNK2005: "public: int __thiscall ArraycAVMCOM::Index(class cAVMCOM * const &,bool)const " (?Index@ArraycAVMCOM@@QBEHABQAVcAVMCOM@@_N@Z) already defined in AVMCOMM.obj
AVMODEM.obj : warning LNK4006: "public: __thiscall ArraycAVMCOM::~ArraycAVMCOM(void)" (??1ArraycAVMCOM@@QAE@XZ) already defined in AVMCOMM.obj; second definition ignored
AVMODEM.obj : warning LNK4006: "private: void __thiscall ArraycAVMCOM::DoCopy(class ArraycAVMCOM const &)" (?DoCopy@ArraycAVMCOM@@AAEXABV1@@Z) already defined in AVMCOMM.obj; second definition ignored
AVMODEM.obj : warning LNK4006: "public: class ArraycAVMCOM & __thiscall ArraycAVMCOM::operator=(class ArraycAVMCOM const &)" (??4ArraycAVMCOM@@QAEAAV0@ABV0@@Z) already defined in AVMCOMM.obj; second definition ignored
AVMODEM.obj : warning LNK4006: "public: __thiscall ArraycAVMCOM::ArraycAVMCOM(class ArraycAVMCOM const &)" (??0ArraycAVMCOM@@QAE@ABV0@@Z) already defined in AVMCOMM.obj; second definition ignored
AVMODEM.obj : warning LNK4006: "private: void __thiscall ArraycAVMCOM::DoEmpty(void)" (?DoEmpty@ArraycAVMCOM@@AAEXXZ) already defined in AVMCOMM.obj; second definition ignored
AVMODEM.obj : warning LNK4006: "public: void __thiscall ArraycAVMCOM::RemoveAt(unsigned int,unsigned int)" (?RemoveAt@ArraycAVMCOM@@QAEXII@Z) already defined in AVMCOMM.obj; second definition ignored
AVMODEM.obj : warning LNK4006: "public: void __thiscall ArraycAVMCOM::Add(class cAVMCOM * const &,unsigned int)" (?Add@ArraycAVMCOM@@QAEXABQAVcAVMCOM@@I@Z) already defined in AVMCOMM.obj; second definition ignored
AVMODEM.obj : warning LNK4006: "public: void __thiscall ArraycAVMCOM::Insert(class cAVMCOM * const &,unsigned int,unsigned int)" (?Insert@ArraycAVMCOM@@QAEXABQAVcAVMCOM@@II@Z) already defined in AVMCOMM.obj; second definition ignored
AVMODEM.obj : warning LNK4006: "public: int __thiscall ArraycAVMCOM::Index(class cAVMCOM * const &,bool)const " (?Index@ArraycAVMCOM@@QBEHABQAVcAVMCOM@@_N@Z) already defined in AVMCOMM.obj; second definition ignored
AVMTTY.OBJ : warning LNK4006: "public: __thiscall ArraycAVMCOM::~ArraycAVMCOM(void)" (??1ArraycAVMCOM@@QAE@XZ) already defined in AVMCOMM.obj; second definition ignored
AVMTTY.OBJ : warning LNK4006: "private: void __thiscall ArraycAVMCOM::DoCopy(class ArraycAVMCOM const &)" (?DoCopy@ArraycAVMCOM@@AAEXABV1@@Z) already defined in AVMCOMM.obj; second definition ignored
AVMTTY.OBJ : warning LNK4006: "public: class ArraycAVMCOM & __thiscall ArraycAVMCOM::operator=(class ArraycAVMCOM const &)" (??4ArraycAVMCOM@@QAEAAV0@ABV0@@Z) already defined in AVMCOMM.obj; second definition ignored
AVMTTY.OBJ : warning LNK4006: "public: __thiscall ArraycAVMCOM::ArraycAVMCOM(class ArraycAVMCOM const &)" (??0ArraycAVMCOM@@QAE@ABV0@@Z) already defined in AVMCOMM.obj; second definition ignored
AVMTTY.OBJ : warning LNK4006: "private: void __thiscall ArraycAVMCOM::DoEmpty(void)" (?DoEmpty@ArraycAVMCOM@@AAEXXZ) already defined in AVMCOMM.obj; second definition ignored
AVMTTY.OBJ : warning LNK4006: "public: void __thiscall ArraycAVMCOM::RemoveAt(unsigned int,unsigned int)" (?RemoveAt@ArraycAVMCOM@@QAEXII@Z) already defined in AVMCOMM.obj; second definition ignored
AVMTTY.OBJ : warning LNK4006: "public: void __thiscall ArraycAVMCOM::Add(class cAVMCOM * const &,unsigned int)" (?Add@ArraycAVMCOM@@QAEXABQAVcAVMCOM@@I@Z) already defined in AVMCOMM.obj; second definition ignored
AVMTTY.OBJ : warning LNK4006: "public: void __thiscall ArraycAVMCOM::Insert(class cAVMCOM * const &,unsigned int,unsigned int)" (?Insert@ArraycAVMCOM@@QAEXABQAVcAVMCOM@@II@Z) already defined in AVMCOMM.obj; second definition ignored
AVMTTY.OBJ : warning LNK4006: "public: int __thiscall ArraycAVMCOM::Index(class cAVMCOM * const &,bool)const " (?Index@ArraycAVMCOM@@QBEHABQAVcAVMCOM@@_N@Z) already defined in AVMCOMM.obj; second definition ignored
AVTCPIP.OBJ : warning LNK4006: "public: __thiscall ArraycAVMCOM::~ArraycAVMCOM(void)" (??1ArraycAVMCOM@@QAE@XZ) already defined in AVMCOMM.obj; second definition ignored
AVTCPIP.OBJ : warning LNK4006: "private: void __thiscall ArraycAVMCOM::DoCopy(class ArraycAVMCOM const &)" (?DoCopy@ArraycAVMCOM@@AAEXABV1@@Z) already defined in AVMCOMM.obj; second definition ignored
AVTCPIP.OBJ : warning LNK4006: "public: class ArraycAVMCOM & __thiscall ArraycAVMCOM::operator=(class ArraycAVMCOM const &)" (??4ArraycAVMCOM@@QAEAAV0@ABV0@@Z) already defined in AVMCOMM.obj; second definition ignored
AVTCPIP.OBJ : warning LNK4006: "public: __thiscall ArraycAVMCOM::ArraycAVMCOM(class ArraycAVMCOM const &)" (??0ArraycAVMCOM@@QAE@ABV0@@Z) already defined in AVMCOMM.obj; second definition ignored
AVTCPIP.OBJ : warning LNK4006: "private: void __thiscall ArraycAVMCOM::DoEmpty(void)" (?DoEmpty@ArraycAVMCOM@@AAEXXZ) already defined in AVMCOMM.obj; second definition ignored
AVTCPIP.OBJ : warning LNK4006: "public: void __thiscall ArraycAVMCOM::RemoveAt(unsigned int,unsigned int)" (?RemoveAt@ArraycAVMCOM@@QAEXII@Z) already defined in AVMCOMM.obj; second definition ignored
AVTCPIP.OBJ : warning LNK4006: "public: void __thiscall ArraycAVMCOM::Add(class cAVMCOM * const &,unsigned int)" (?Add@ArraycAVMCOM@@QAEXABQAVcAVMCOM@@I@Z) already defined in AVMCOMM.obj; second definition ignored
AVTCPIP.OBJ : warning LNK4006: "public: void __thiscall ArraycAVMCOM::Insert(class cAVMCOM * const &,unsigned int,unsigned int)" (?Insert@ArraycAVMCOM@@QAEXABQAVcAVMCOM@@II@Z) already defined in AVMCOMM.obj; second definition ignored
AVTCPIP.OBJ : warning LNK4006: "public: int __thiscall ArraycAVMCOM::Index(class cAVMCOM * const &,bool)const " (?Index@ArraycAVMCOM@@QBEHABQAVcAVMCOM@@_N@Z) already defined in AVMCOMM.obj; second definition ignored
This is my declaration of my class:

Code: Select all

WX_DECLARE_EXPORTED_OBJARRAY(cAVMCOM *, ArraycAVMCOM);
#include <wx/arrimpl.cpp> 
WX_DEFINE_EXPORTED_OBJARRAY(ArraycAVMCOM);
extern ArraycAVMCOM arrpcAVMCOM;
In the cpp files that I use that variable i delcare it like this:
ArraycAVMCOM arrpcAVMCOM;

If anyone could shed some light for me i would apreciate.

Thanks
Bye
tan
wxWorld Domination!
wxWorld Domination!
Posts: 1471
Joined: Tue Nov 14, 2006 7:58 am
Location: Saint-Petersburg, Russia

Post by tan »

Hi,
you have not to define class instance in .h file, only to declare it.

.h

Code: Select all

WX_DECLARE_EXPORTED_OBJARRAY(cAVMCOM *, ArraycAVMCOM);
extern ArraycAVMCOM arrpcAVMCOM;
.cpp (only in one file)

Code: Select all

#include <wx/arrimpl.cpp>
WX_DEFINE_EXPORTED_OBJARRAY(ArraycAVMCOM);
ArraycAVMCOM arrpcAVMCOM;
OS: Windows XP Pro
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10
rodrigod
I live to help wx-kind
I live to help wx-kind
Posts: 172
Joined: Thu Jun 26, 2008 8:50 pm

Post by rodrigod »

Thanks for the fast and precise answer that handled my problem!!!
Post Reply