Hi,
@kbw is correct once again.
I'd like to expand upon it as Richard Feynman once said 'I learned the difference between knowing the name of something and knowing something' so I'd like to explain why this fails.
The reason this fails because MSDN is an Microsoft websites (very obvious) and since Microsoft have developed the well-known IDE and compiler Visual C++ they use the VC++ working code and in VC++ the developer can tinker with the project settings (linking being case here) in-code and the way they can do this is by using the
The
I hope this helps & good luck on your endeavors,
OrionMaster
@kbw is correct once again.
I'd like to expand upon it as Richard Feynman once said 'I learned the difference between knowing the name of something and knowing something' so I'd like to explain why this fails.
The reason this fails because MSDN is an Microsoft websites (very obvious) and since Microsoft have developed the well-known IDE and compiler Visual C++ they use the VC++ working code and in VC++ the developer can tinker with the project settings (linking being case here) in-code and the way they can do this is by using the
#pragma
directive and since directives depend on the compiler, I conclude #pragma comment()
is an VC++ only directive and since Orwell Dev-Cpp is not an VC++ compiler type but rather an MingW based it will not work.The
#pragma comment(lib, 'Ws2_32.lib')
is an way of telling the VC++ compiler to link with library ws2_32.lib so on VC++ it does this, and the code will work but unfortunately since Orwell Dev-Cpp does not have this capability you must perform this task manually by linking Ws2_32.lib to the project. Then it will successfully execute and work!I hope this helps & good luck on your endeavors,
OrionMaster
Ws2_32.lib Dev C 5
You will also need to add ws232.lib to the list of library files, so the linker wont freak. To do this, go to the Visual Studio menu, Project-Win32WrapperClass Properties-Linker-Input and add ws232.lib to the Additional Dependencies field. The following is the complete source code for the basic Winsock TCP/IP Client Application.
@kiberg The -c switch means compile or assemble the following file, but do not link. You definitely don't want to compile libsw232.a or Chat1.h. The answers that they offered speak that the #pragma comment(lib, 'Ws232.lib') that I place at the beginning of the program is not valid for the compiler gcc but only for visual c and that instead of that I have to add the library manually through the makefile by placing -L'ws232' however try to put it in some places and the springs kept.