winsock.h or winsock2.h can i choose? 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
Sunsawe
Experienced Solver
Experienced Solver
Posts: 54
Joined: Tue Jan 30, 2007 5:04 pm

winsock.h or winsock2.h can i choose?

Post by Sunsawe » Sun Jun 03, 2007 9:45 pm

Hi,

I'm developping a small project under windows with visual studio 2005.
I am using a librairie in my project which uses winsock2.h
But the wxWidget part of the project use winsock.h and of course there are issues and compil time errors.

What is the difference between winsock.h and winsock2.h? Are they 2 completely different things or just updates? Is it possible to set wxWidgets to use winsock2.h? can it work with it?

thank you

Kervala
Earned a small fee
Earned a small fee
Posts: 23
Joined: Thu Sep 02, 2004 1:41 pm
Location: France
Contact:

Post by Kervala » Mon Jun 04, 2007 10:50 am

What does happen if you include winsock2.h before wx.h ?

In new Windows SDK, windows.h is including winsock.h excepted if some defines are defined (which ones are also defined in winsock2.h) :)

Sunsawe
Experienced Solver
Experienced Solver
Posts: 54
Joined: Tue Jan 30, 2007 5:04 pm

Post by Sunsawe » Mon Jun 04, 2007 10:28 pm

well i tried but...
If the part of the project that i was looking for can compil, the main project gives:

Code: Select all

hello.obj : error LNK2001: unresolved external symbol "public: virtual class wxClassInfo * __thiscall wxEvtHandler::GetClassInfoW(void)const " ([email protected]@@[email protected]@XZ)
TestFrame.obj : error LNK2001: unresolved external symbol "public: virtual class wxClassInfo * __thiscall wxEvtHandler::GetClassInfoW(void)const " ([email protected]@@[email protected]@XZ)
TestFrame.obj : error LNK2001: unresolved external symbol "public: virtual class wxClassInfo * __thiscall wxGDIObject::GetClassInfoW(void)const " ([email protected]@@[email protected]@XZ)
do you know how to solve that ones?

Kervala
Earned a small fee
Earned a small fee
Posts: 23
Joined: Thu Sep 02, 2004 1:41 pm
Location: France
Contact:

Post by Kervala » Mon Jun 04, 2007 10:45 pm

You surely forgot IMPLEMENT_CLASS() macro in the .cpp file for your class :)

Sunsawe
Experienced Solver
Experienced Solver
Posts: 54
Joined: Tue Jan 30, 2007 5:04 pm

Post by Sunsawe » Tue Jun 05, 2007 6:17 am

Actually... i have never used that before...
But i tried, i had

Code: Select all

DECLARE_CLASS(class);
in the two classes (.h file) deriving from a wxWidgets class and

Code: Select all

IMPLEMENT_CLASS(classname, baseclass)
in their cpp files.

Then it does.... nothing!

Still have exactly the same errors. I also tried with

Code: Select all

DECLARE_DYNAMIC_CLASS
and same result!


:(

Kervala
Earned a small fee
Earned a small fee
Posts: 23
Joined: Thu Sep 02, 2004 1:41 pm
Location: France
Contact:

Post by Kervala » Tue Jun 05, 2007 7:39 am

Did you inherite your class from a wxObject derivated class ?

Sunsawe
Experienced Solver
Experienced Solver
Posts: 54
Joined: Tue Jan 30, 2007 5:04 pm

Post by Sunsawe » Tue Jun 05, 2007 11:09 am

my classes are inheriting from wxApp and wxFrame.

Kervala
Earned a small fee
Earned a small fee
Posts: 23
Joined: Thu Sep 02, 2004 1:41 pm
Location: France
Contact:

Post by Kervala » Tue Jun 05, 2007 11:27 am

Good :)

What else...

Did you link your program to correct libraries ?

Sunsawe
Experienced Solver
Experienced Solver
Posts: 54
Joined: Tue Jan 30, 2007 5:04 pm

Post by Sunsawe » Tue Jun 05, 2007 4:38 pm

well....
i'm not linking explicitely with anything. i'm using the automatic linking (don't know exactly how it works but it does...)

Why including winsock2.h is creating those errors? Something is missing in the linking thing obviously but which part of wxWidgets?

:cry:

Sunsawe
Experienced Solver
Experienced Solver
Posts: 54
Joined: Tue Jan 30, 2007 5:04 pm

Post by Sunsawe » Wed Jun 06, 2007 10:43 pm

i found on the net.
Including wx/msw/winundef.h right after winsock2.h solved the problem.

Kervala
Earned a small fee
Earned a small fee
Posts: 23
Joined: Thu Sep 02, 2004 1:41 pm
Location: France
Contact:

Post by Kervala » Thu Jun 07, 2007 8:46 am

Hehe, well done :p

Post Reply