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 »

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 »

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 »

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 " (?GetClassInfoW@wxEvtHandler@@UBEPAVwxClassInfo@@XZ)
TestFrame.obj : error LNK2001: unresolved external symbol "public: virtual class wxClassInfo * __thiscall wxEvtHandler::GetClassInfoW(void)const " (?GetClassInfoW@wxEvtHandler@@UBEPAVwxClassInfo@@XZ)
TestFrame.obj : error LNK2001: unresolved external symbol "public: virtual class wxClassInfo * __thiscall wxGDIObject::GetClassInfoW(void)const " (?GetClassInfoW@wxGDIObject@@UBEPAVwxClassInfo@@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 »

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 »

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 »

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 »

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 »

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 »

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 »

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 »

Hehe, well done :p
Post Reply